Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PowerShell script that automates log file cleanup based on retention rules defined in a CSV. Includes a log generator for testing.

Notifications You must be signed in to change notification settings

kgkswapan/file-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileCleaner

A PowerShell project for periodic log file cleanup.
Includes a log generator sub-project for testing purposes.

How it works

  • Reads directories and retention days from LogDirectories.csv
  • Finds log files matching pattern Application-Log-YYYY-MM-DD.txt
  • Deletes files older than the retention period
  • Includes LogGenerator.ps1 to create sample logs with date stamps

Run

# Run log generator (inside Logs folder)
.\LogGenerator.ps1

# Run file cleaner
.\filecleaner.ps1

Example CSV Format

DirectoryPath,KeepForDays
.\Logs,30

License

MIT

About

PowerShell script that automates log file cleanup based on retention rules defined in a CSV. Includes a log generator for testing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published