Post a reply

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)


Topic review


Re: Help getting filemask correct for rm command

No, it's not possible. But It's not difficult to code this in more powerful language, like PowerShell, with use of WinSCP .NET assembly.

Help getting filemask correct for rm command

I have a requirement to remove files from a remote directory that meet the following conditions:

  • are older than 3 days
  • have an extension of *.pgp
  • do NOT contain "KPG" in the file name

I can meet the first 2 criteria with the following:
rm *.pgp<3D

But I'm unable to get the 3rd criteria to work. I've tried this but get an error message:
rm *.pgp<3D|*KPG*

Is this possible to do with the rm command? Thank you for your time.