Synchronize -filemask and exclude empty directories (command line)
I realise the below script is not correct as I have a few queries about how to move forward.
- I am writing a script for file transfer synchronisation
- I wish to sync my local directory with the remote directory but I don't want all the remote directory empty folders?
- I also only want the most recent files available from the non-empty directories of the Remote end sync's into me local end?
- I will schedule this .bat file once complete to run every 15 minutes
- The below synchronisation still downloads the empty directories?
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" set datestamp=%YYYY%%MM%%DD% set CONN_SFTP_SVR="ftp://user:password!@10.10.10.10 hostkey=* -rawtransfersettings ExcludeEmptyDirectories=1" ::::::I tried the '-rawtransfersettings ExcludEmptyDirectories=1' here, but I am not sure how to include this?::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: set LOCAL_DIR1="D:\A\B\C\D\E\" set LOCAL_DIR2=""D:\A\B\C\D\A1\" set LOCAL_DIR3=""D:\A\B\C\D\A2\" set LOCAL_DIR4=""D:\A\B\C\D\A3\" set REMOTE_DIR1="D:\A\B\C\D\E\" set REMOTE_DIR2=""D:\A\B\C\D\A1\" set REMOTE_DIR3=""D:\A\B\C\D\A2\" set REMOTE_DIR4=""D:\A\B\C\D\A3\" set file_pattern=*%datestamp%*statsfile.xml "C:\Program Files (x86)\WinSCP\WinSCP.exe" /xmllog=D:\Logs\!Y!M!D_!T_LOGS.xml "/script=D:\LOACTION\TheCommands.txt"
###################################This is my transfer####################### ##A new file arrives on the remote server every 15 minutes and I wan to collect the most recent one. I use >15N but maybe there is a better way?######## open %CONN_SFTP_SVR% option batch abort ######Example of dir 2 only########## synchronize local -filemask=%file_pattern%>=15N %LOCAL_DIR2% %REMOTE_DIR2% close