How to delete all files in a directory except the three most recent?
Hi all. I have a WinSCP script that automatically downloads a file from my remote directory to a local directory. This occurs once a week, and I would like to add additional code to my script so that my local directory keeps at most three such backups. How might I approach that? I gather the rough logic would be:
* Count number of files in local directory (this directory stores only these backup files--nothing else).
* If number of files is greater than three, delete the oldest file.