Using the 'forfiles.exe' to manage log files

Tags: IIS

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:pathtolog-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)

1 Comment

  • http:// said

    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!!

Add a Comment