I have a script I use to automate the synchronization of a remote folder.
The name of this folder changes based on the delivery date of the data. So each month the date suffix at the end of the directory changes. Currently below is the batch script I use to synchronize:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="\\SERVER\Geochem\Alberta Energy Regulator\REPS Compilation\SYNC_LOGS\REPSCD_Sync_!Y_!M.log" /ini=nul ^
"open sftp://ACCOUNTNAME:PA$$W0RD@datasubscriptions.eub.gov.ab.ca/ -hostkey=""ssh-rsa 2048 REeK/HGvi9iVUxPd0zgVXtlEMgkumbjAaosOht5JbRg"" -rawsettings FSProtocol=2" ^
"synchronize local ""\\s-cal-nas8\Geochem\Alberta Energy Regulator\REPS Compilation"" ""/REPS Reports_""%%TIMESTAMP-30D#yyyy_mm%%" ^
if %WINSCP_RESULT% equ 0 (
) else (
The timestamp has been working just fine for the most part, however the format of the date suffix can change slightly with each data release. As in, a
and vice versa.
Ideally the data provider would be consistent in their directory name format but if I could use a wildcard in the path of my synchronization like:
I would be fine as the name before the date never changes.
I've looked online and it appears to be a fairly requested feature and attempting to make it work by other means seems unnecessarily difficult. Please consider adding as a function, thank you.