Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.

Topic-icon Question Action Copy File or Concat File to rename a file

More
14 Jun 2017 12:14 - 14 Jun 2017 12:21 #1 by Virginie_Samson
Virginie_Samson created the topic: Action Copy File or Concat File to rename a file
Hello
I need to rename a file to a generic name.
Example : STOCK_EC_20170601.csv rename to STOCK_EC.csv

We tryed with a copy file, but we get an error

Could you help us please?
Si join

Thanks
Virginie

This attachment is hidden for guests.
Please log in or register to see it.

This message has an attachment file.
Please log in or register to see it.

Last Edit: 14 Jun 2017 12:21 by Virginie_Samson.
More
15 Jun 2017 13:14 #2 by Thomas BLETON
Thomas BLETON replied the topic: Action Copy File or Concat File to rename a file
Try using a FileMove action, you can change the name of the file.
Parameters :
FILE_FROM_FILE: d:/temp/file_a.txt
FILE_TO_FILE: d:/temp/file_b.txt
More
01 Dec 2017 22:07 #3 by Virginie_Samson
Virginie_Samson replied the topic: Action Copy File or Concat File to rename a file
Hello
If the file name change (with a moving date), would it work with the key word * ?
Example
File_To_Tranfert_20171201.txt
the day after : File_To_Tranfert_20171202.txt

If we call it with File_To_Tranfert_*.txt is that ok?

Thanks
More
14 Dec 2017 09:29 #4 by risson
risson replied the topic: Action Copy File or Concat File to rename a file
FILE_FROM_FILE => FILE_TO_FILE works with a specified constant name.

I'm not sure it is a good idea to rename File_*.txt to File.txt, because it would mean you lose files when there are several files matching the File_*.txt pattern.

Maybe you can use FileWait to ensure you get only the first file which matches the pattern:
- WAIT_FILE_DIR: /home/risson/datafiles/testmovefiles/
- WAIT_FILE_INCLUDES: File_*.txt
- WAIT_FILE_NB: 1
- WAIT_FILE_TIMEOUT: 1

=> Then bind this to a MoveFile action:
- FILE_FROM_FILE: :{FILE_DIR}:/:{FILE_NAME}:
- FILE_TO_FILE: :{FILE_DIR}:/MyTargetFile.txt