Topic "Delete files that have older timestamp"

Author Message


I want to create a script file that when run, it will find files that have older modified date than a specific time.

For example: I have 5 files A, B, C, D, E, each file create a day after the previous file, so if A is created on 1/1/2012 then B is created on 2/1/2012, C is created on 3/1/2012 and so on. I want the script to always delete files that 2 days old than the latest file, which is E(5/1/2012). Meaning when run the script will find files that 2 days older than the latest file then delete them, in this case, A,B will be deleted, and if more files create after each day, let say F, G are created on 6/1/2012 and 7/1/2012, then when we run the script again, it will delete C, D.

Is it possible to make a script like that?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
This example may help you:
Martin Prikryl

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License