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

One thought on “Using the ‘forfiles.exe’ to manage log files”

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

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: