All - I am new to ScriptFTP and if I missed the answer to my question when I searched the forums I apologize in advance.
I am working on a script that needs to create a folder on a network share based on a past date. In addition I am needing to download files from the remote sFTP server that use this same past date. I am able to get my script to work using the (FORMAT0) format but am trying to get the defined variable into the (FORMAT3) so that I have YYYYMMDD layout.
The remote files are loaded to the FTP server weekly on a Wednesday with a file date from 2 Friday's prior (so if the file is loaded tomorrow on FTP, the date in the file would be 7/28)
I have defined variables that can get me the correct date using the (FORMAT0) layout:
This works fine. And then I can create a new directory:
My desired directory name is 20170727
I have tried different syntax methods to get the format for the variable $filedate to use (FORMAT3) but all fail. I also need this same format to use in the GETFILE command to grab the correct file from the remote FTP server....
Any assistance is appreciated!
I am working on a script that needs to create a folder on a network share based on a past date. In addition I am needing to download files from the remote sFTP server that use this same past date. I am able to get my script to work using the (FORMAT0) format but am trying to get the defined variable into the (FORMAT3) so that I have YYYYMMDD layout.
The remote files are loaded to the FTP server weekly on a Wednesday with a file date from 2 Friday's prior (so if the file is loaded tomorrow on FTP, the date in the file would be 7/28)
I have defined variables that can get me the correct date using the (FORMAT0) layout:
FTP Script
- $filedate=$date-(12*24*60*60)
FTP Script
- # creates the directory like so: 2017_7_27-12_10_43
I have tried different syntax methods to get the format for the variable $filedate to use (FORMAT3) but all fail. I also need this same format to use in the GETFILE command to grab the correct file from the remote FTP server....
Any assistance is appreciated!
Thanks for posting here. Don't worry a question like this has never been answered in the forum
I would update ScriptFTP to the latest version. In the recent releases the date/time format always uses two digits for months, days etc. For example the date/time you used would be:
2017_07_27-12_10_43
This makes much easier to extract the day and the month with TEXTCUT as they always have the same position in the text string:
The output of the script is:
LOCALMKDIR($filedate) - which creates the directory like so: 2017_7_27-12_10_43
I would update ScriptFTP to the latest version. In the recent releases the date/time format always uses two digits for months, days etc. For example the date/time you used would be:
2017_07_27-12_10_43
This makes much easier to extract the day and the month with TEXTCUT as they always have the same position in the text string:
FTP Script
GETTIME("FORMAT0")
TEXTCUT("2017_07_29-18_46_45","1","4")
TEXTCUT("2017_07_29-18_46_45","6","2")
TEXTCUT("2017_07_29-18_46_45","9","2")
20170729
liked Script FTP? Try our other product Email Parser
Just updated to 4.3 and this works perfect now. Thank you so much!!