Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Shibbard50

Yes, it's a symlink, I wondered if that was part of the problem. I'm not sure why I used SCP in the original script - I generated the code from my original profile, I'm learning as I go and that was probably the first connection I had success with. Switching to SFTP solved this issue for me, thanks very much! this is a very nice utility.
martin

The /home/forge/ArtUploadArchive is actually a symlink, right?
WinSCP gets confused by that.
Why do you actually use SCP protocol? With SFTP protocol there should be no problem. Or use a final path, instead of the symlink.
Shibbard50

Ugh, sorry! that was a copy/paste error, I am using the syntax <120D.

Any other ideas of why this is not working? Please note my comment that the filter also didn't work with the mast *.psf but did work when I made it the single filename ABBanner.psf...

I've attached a log file from running today minus identifying informaiton. Also a screen shot of the filezilla listing showing files that are <120D.

thanks!
Shibbard50

PRoblem with file mask <D

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:

@echo off


"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\Capture\WinSCP.log" /ini=nul ^
  /command ^
    "open scp://xxx@xxx.xxx.xxx.xxx/ -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""" ^
    "rm /xxx/xxx/ArtUploadArchive/*<120"
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

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?