0

We have 4 servers (Windows 2003 R2), each with a log-directory with thousands of log-files. I have written a log-viewer that collect log-files within a date range and show them in a grid. But this is rather slow as the number of log-files grow fast.

If I could schedule to move all files older than N days to an zip-archive I think the logviewer should be much faster. I'm not good at write bat-files. Any suggestions ?

berocoder
  • 197
  • 2
  • 9

1 Answers1

1

You should be able to use forfiles:

forfiles /m *.log /c <zip up here> /d -N

The /d switch tells forfiles to only consider files older than N days. Of course, you need to replace N with a nice number.

Joey
  • 1,853
  • 11
  • 13