Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 846 Bytes

File metadata and controls

26 lines (20 loc) · 846 Bytes

Remove-RedundantLogFiles

Script for removing old log files

Features

  • Shows number of files found
  • Lists old files from given directory
  • Adds scheduled task in the system to run on daily basis

image

Examples

Finds files 30 days old in given directory and asks what to do

.\Remove-RedundantLogFiles.ps1 -FolderPath C:\inetpub\logs\LogFiles

Finds files 5 days old in given directory and asks what to do

.\Remove-RedundantLogFiles.ps1 -FolderPath C:\inetpub\logs\LogFiles -DaysOld 5

Removes 10 day old files from given directory without any prompt and logs number of deleted files

.\Remove-RedundantLogFiles.ps1 -FolderPath C:\inetpub\logs\LogFiles -DaysOld 10 -RemoveFiles