Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mickael_Ro
Contributor II
Contributor II

Rename a list of files

I want to import files from an smtp server, put them locally and rename them. All this on a daily basis.
The files are in the form “filename+date.csv” except that I want to remove the date from the names of the various files.
Currently, I'm able to retrieve the files and put them locally, but I can't set the tFileCopy component to remove the date characters from the file name.

Mickael_Ro_0-1743414289044.pngMickael_Ro_1-1743414337069.png

Thanks à lot

Labels (3)
1 Solution

Accepted Solutions
Mickael_Ro
Contributor II
Contributor II
Author

I've used this and it works:

Mickael_Ro_0-1743491517433.pngMickael_Ro_1-1743491527102.png

 

View solution in original post

2 Replies
mchapman
Employee
Employee

Before:

mchapman_2-1743450593011.png

 


After:

mchapman_3-1743450643856.png

 

 

Use this to remove the date from files (this example assumes .csv files with _ between the filename and the date, so modify the RegEx as needed):

((String)globalMap.get("tFileList_1_CURRENT_FILE")).replaceAll("_[0-9]{8}\\.csv$", "\\.csv")

Mickael_Ro
Contributor II
Contributor II
Author

I've used this and it works:

Mickael_Ro_0-1743491517433.pngMickael_Ro_1-1743491527102.png