Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

MENU MENU
Post a message here if you find anything wrong in ScriptFTP.
In order to transfer instrument data files, I need yesterdays date as part of the file name. There is no mention, so far, of a date function that does this. I would like to be able to do something like this if the current date is 16 December 2008:
Code: Select all$past_file_name = TEXTCUT(GETDATE(FORMAT3-1),3,-1)."LidarData.dat" with result of 081215LidarData.dat
Does this capability exist?

The reason I'm asking is that the example given on page 140 of the pdf manual doesn't work. For example, if I use this script
Code: Select all# Get the current date in the format AAAA_MM_DD-hh_mm_ss $currentdate=GETDATE(FORMAT0) # Then, you can substract or add seconds to that date stored # in the variable. Yesterday is: $yesterday=$currentdate-(60*60*24) # (3600*60*60) is the amount in seconds in a day. # This should print the yesterday date: PRINT($yesterday)
I get these values for subtracting one second:
$currentdate as 2008_12_16-12_09_45 and $currentdate-1 as 2008_02_06-12_09_44;
these values for subtracting one day:
$currentdate as 2008_12_16-12_07_11 and $currentdate-(60*60*24) as 2008_02_06-12_06_47
Hello strangeplant,
Does this capability exist?
It exists but not with that syntax. You have to use the minus operator to substract seconds, as you have already seen in the page 140 of the pdf manual. Unfortunately this feature is not well documented, it has been added in the recent builds.
I get these values for subtracting one second:
$currentdate as 2008_12_16-12_09_45 and $currentdate-1 as 2008_02_06-12_09_44;
these values for subtracting one day:
$currentdate as 2008_12_16-12_07_11 and $currentdate-(60*60*24) as 2008_02_06-12_06_47
Yes, the result is completely wrong. I'll fix the bug this Friday and release a new build. I'll be out of the office tomorrow, sorry.