PRoblem with file mask <D

Advertisement

Shibbard50
Donor
Joined:
Posts:
3

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?

Reply with quote

Advertisement

Shibbard50
Donor
Joined:
Posts:
3

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!

120D.PNG

Reply with quote

martin
Site Admin
martin avatar

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.

Reply with quote

Shibbard50
Donor

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.

Reply with quote

Advertisement

You can post new topics in this forum