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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to read and rename a file ?

Hi everyone, 

 

I want to read the file name and rename it as follows:

 

xyz_20200101_1234 -> xyz_CW01_1234

xyz_20200108_1234 -> xyz_CW02_1234

 

What do you suggest to enable this task? Smiley Happy

 

Kind regards, 

Newbee

 

 

 

Labels (2)
5 Replies
Anonymous
Not applicable
Author

unfortunately it is not the same.

 

I need to read a part of the file name. In my example it is the file date. After that, I need to convert the date into the calender week format/week number format.

 

Best regards, 

Newbee

manodwhb
Champion II
Champion II

@TalendNewbee11 , you use the tfileist and then use some java to convert to whatever you want to need,for that you need to know java.

Anonymous
Not applicable
Author

@manodwhb  yes, I know. It works to rename a file and move it to another folder.

 

However, my case is the following: 

 

I have a file name that I want to analyze. There are 3 pieces of information within this file name:

 

XXX_20200430_1234

 

XXX = name , 20200430 = Date in which the file was written , 1234 = serial number

 

In this case I would like to explicitly convert the date within the file name to another date format

The other information should be copied.

 

The result should be:

 

xxx_CW17_1234

manodwhb
Champion II
Champion II

In Java first you need to split those values into three different variables and then take current week date and concatenate with first variable + current week variable + serial number variable.