Delete old files via command line
Ever wanted to delete files of a certain type but keep files not older than 30 days? Well, here is a fast and simple way to clean up, for example old IIS log files in seconds.
Open command line and type the following:
The text in italic bold are parameters you can change to your needs. Adjust the „-30“ to age of log files to keep (in days) and the path to the log files, in this case „C:\inetpub\logs\LogFiles“.
This can be used to delete many file types. For this edit the „*.log“ to the needed filter