Using the 'forfiles.exe' to manage log files

Here is a good tip I received in the IIS newgroups managing log files.   Thanks 'Tomek' for passing this along.

1) Create - BAT-File (in the same Path like forfiles.exe)
2) forfiles.exe - syntax

forfiles - pC:\path\to\log-files - s -m*.* -d-60 -c"cmd /C del /q @FILE"

-m : defines the Filename and extension
-d : the age of the Files in days
-c : command to run (in our case - delete)

Published Friday, June 30, 2006 1:48 PM by steve schofield
Filed under:

Comments

# re: Using the 'forfiles.exe' to manage log files

Wednesday, September 05, 2007 5:57 PM by Mark W - St. Louis

THANKS so much for this one little FORFILES line.  I have searched high and low and tried about a hundred variations to delete files in a directory and nothing worked, except your command.  Thanks!!