Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

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
Action Copy File or Concat File to rename a file was created by Virginie_Samson
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
Replied by Thomas BLETON on 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
Replied by Virginie_Samson on 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
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