-2

I've looked around here for an answer to my question but it doens't look like anyone has so far got there.

I'm looking for a way to selectively DELETE files from a directory, so I have; Every file in the last 7 days one file for every 30 days.

So in effect I've got last week and then a file for each month. I'd like to use a batch script to do the delete or a GUI, I don't mind, but it needs to be something I can schedule. At the moment I'm hand tweening out the files...

Most of the answers are for linux; daily, weekly, yearly backup script this one seems close.

Would appreciate any help as it'll shave valuable minutes of my day and free up some storage.

bookstorecowboy
  • 117
  • 1
  • 2

1 Answers1

4

The forfiles command can select files based on their ages, so something like this could be used to delete log files 7 or more days old:

forfiles /d -7 /c "cmd /c echo @file"

To save a monthly copy, use the task scheduler to copy that file to an archive folder once a month.

ramruma
  • 2,740
  • 1
  • 15
  • 8
  • Thanks Ramruma, I've been thinking about this and I think it might be a good idea to write a little app to do it. If I do I'll post on here so people with the same problem can use it. – bookstorecowboy Aug 19 '12 at 16:50