How To timestamp downloads
Sometimes it is necessary to dynamically change the destination file/folder name. For example if you have a backup task scheduled which should put the files into a different folder each time it is started. The solution is to use a transfer queue item script from the SmartFTP SDK.
In this example we setup a task which downloads a folder from a server to a local folder:
- Schedule a transfer as shown in the Schedule a Transfer of a Folder tutorial at:
- Once the transfer has been scheduled, go to the Scheduler pane
- Right-click the scheduled task and select Properties from the context menu.
- Select the Actions tab
- Right-click the Queue Item action and select Properties from the context menu.
- Click on Transfer Queue Item Properties
- Select the Script tab
- Install the SmartFTP SDK
- In the script input box, select the Samples\TransferQueueItem\JScript\DynamicDestination.js script from the SmartFTP SDK.
- Look at the DynamicDestination.js for the formatting of the final destination path.
For example to add a "mmddyy.HHMMss" suffix to the destination path enter the following into the script Arguments input box:
"item.Destination.Path + dateFormat(Date(), 'mmddyy.HHMMss') + '.tmp'"
What do you think about this topic? Send feedback!