Delete files that have older timestamp

Advertisement

Kuro
Guest

Delete files that have older timestamp

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?

Reply with quote

Advertisement

You can post new topics in this forum