I have a seemingly simple task that I am not able to make work: log in to FTP and delete files in folder older than 120 days. Here is the script I have, based on your examples and generated from the GUI:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Capture\WinSCP.log" /ini=nul ^
"open scp://email@example.com/ -hostkey=""ssh-ed25519 256 2c:3b:da:f4:2e:9f:7d:cd:3d:48:11:ef:ce:cc:e8:23"" -privatekey=""N:\xxx"" -rawsettings AuthKIPassword=0 TunnelPublicKeyFile=""xxx""" ^
if %WINSCP_RESULT% equ 0 (
) else (
exit /b %WINSCP_RESULT%
I definitely have files in that folder older than 120 days, just a few but they are there. When it didn't work, I tried changing the mask to a filename with wildcard ("rm /xxx/xxx/ArtUploadArchive/*.psf", and the message said 'No file matching *.psf found'.
However, when I changed it to "rm /xxx/xxx/ArtUploadArchive/ABbanner.psf", that file was deleted. This file is older than 120 days, fwiw.
What am I missing?