Fixed. Needed to use 7zip and perform the compression before the transfer.
"C:\Program Files\7-Zip\7z.exe" a -r %BackupFile% D:\Report\Today
I am having difficulty getting my WinSCP script to compress a folder containing large CSVs and unfortunately have no found an answer in the forum posts.
I am using a wrapper script to create a Windows batch file which runs as a scheduled task.
I am unsure whether I need to create a WinSCP custom zip command or whether I am even on the right track trying to compress the folder within my script. Any advice would be appreciated!
Here is my current code:
REM Local directory where CSV files are found
REM The local directory where script files are kept
REM change to SFTP folder
REM Delete batch file config
REM Create text file with transfer parameters
ECHO option batch on > "%WORKDIR%\SFTP_today.txt"
ECHO option confirm off >> "%WORKDIR%\SFTP_today.txt"
ECHO open %SFTPURL% -hostkey="ssh-rsa 123abc">> "%WORKDIR%\SFTP_today.txt"
REM change to remote folder
ECHO cd Today >> "%WORKDIR%\SFTP_today.txt"
REM change to local folder
ECHO lcd %LCD% >> "%WORKDIR%\SFTP_today.txt"
REM create zip folder zipFileName | folderName
ECHO zip -r D:\Reports\todayArchive.zip D:\Reports\Today >> "%WORKDIR%\SFTP_zip.txt"
REM transfer zip file
ECHO put *.zip>> "%WORKDIR%\SFTP_today.txt"
ECHO bye >> "%WORKDIR%\SFTP_today.txt"
REM run script