I have a script to fetch files from FTP. I want to put the file in a different folder based on a date that's part of the remote file's name.
E.g. if the remote file is named RemoteFile_2016_05_03.csv I want to put it in folder Fetched Files\2016-05-03\.
I know how to extract the date using regex, and already use that to rename some other files, changing the date separator in the process.
I also know I can use the create right option for the load command to create a new folder. But how can I get the extracted date into the right folder name in the load command?
Or is there any other way to achieve this? Can rename or moveto be used in any way to do what I want?
E.g. if the remote file is named RemoteFile_2016_05_03.csv I want to put it in folder Fetched Files\2016-05-03\.
I know how to extract the date using regex, and already use that to rename some other files, changing the date separator in the process.
I also know I can use the create right option for the load command to create a new folder. But how can I get the extracted date into the right folder name in the load command?
Or is there any other way to achieve this? Can rename or moveto be used in any way to do what I want?
Comment