Clear Windows Log Files
Many services and programs out there produce log files as an audit trail for everything they are doing, however few have a function which removes these files as they outlive their usefulness. As a result, these log files sit on your system eating up space (sometimes more than you know) and cluttering directories for those times you need to access them.So if you don’t need these files, why keep them?
Windows upgrade log files: When you upgrade Windows–for example, upgrade from Windows 7 to 10, or upgrade from Windows 10’s November update to Windows 10’s Anniversary update–Windows creates log files. These log files can “Help identify and troubleshoot problems that occur”.
We are going to show you how to easily remove these old log files to keep you system nice and tidy.Of course, while the we are covering below are immediately useful for managing log files, you can also apply the same techniques to any other type of “expiring” file (such as backups). Remove Files Based on Last Modified DateIf you want to clear your existing log files based solely on the last modified date of the file, all you have to do is use the FORFILES command. For example:FORFILES /P “C:LogFiles” /S /D -7 /C “CMD /C DEL /F /Q @PATH”The above command would delete all files from the “C:LogFiles” folder, and all sub-folders which have not been modified in the last week.The FORFILES command is pretty flexible with the search pattern and date functions. For example, in place of a number, you can enter a date such as ‘-1/13/2010’ to delete files last modified prior to the specified date.To get all the details on what FORFILES can do, view the online help using the following command from the command prompt:FORFILES /? Remove Files Based on a Date Pattern in the File NameMany applications and services produce log files based on a date pattern as to have one log file per day (i.e. Log100113.txt, Backup-2010-01-13.zip, etc.). For these types of files, it is preferable to delete based on the date of the file incorporated into the file name rather than the last modified date.
Delete Windows Event Log Files
Scan an item windows defender ltsb. This is useful for scenarios such as keeping all log files for the past 3 months. Unfortunately, Windows does not have a native command with this type of logic but with a batch script we can easily handle this task.There are examples included in the usage comments on the script, so it should be pretty easy to figure out.