Sysax Product Forums / Sysax FTP Automation / General Discussion / Rename file and datestamp
Posted:  04 Nov 2010 18:31
I want to download a file (say, DownloadOne.txt) and then rename it with datestamp YYYYMMDD (not time)

e.g. 20101104_DownloadOne.txt

then I want to move only that file to another folder

e.g. from C:\Temp to C:\Temp\Archive

Looked at scripting manual but cannot get it to work.

Thanks.
Posted:  08 Nov 2010 23:39
Here is how you can prepend the datestamp to the file:

setvar ~myfile, "DownloadOne.txt";
formattimestamp ~mytimestamp, "%YYYY%%MM%%DD%";
strprint ~mytimestampedfile, ~mytimestamp, "_", ~myfile;

Instead of downloading, renaming, and moving, you can simply download this to to the final destination folder using the timestamped name like this:

ftpsetpath local, "C:\\Temp\\Archive";
ftpdownload file, ~myfile, ~mytimestampedfile;
 

Copyright © 2021 Codeorigin, LLC - All Rights Reserved.
XML RSS 2.0 XML Atom 1.0