PowerShell Log File Cleaner App

PowerShell Log File Cleaner App

Model: Claude
Difficulty: Intermediate
Upvotes: 1
automationcleanuplogsPowerShellWindows

โ€” Prompt โ€”

Draft a PowerShell script that finds and deletes all .log files older than [X] days in [folder], outputs a summary to the screen, and logs to a file.

Why It Works

Saves disk space, automates routine cleanup, and documents what was deleted.

Example Output

Folder: C:Logs, Days: 30. Script: Get-ChildItem, Remove-Item, Write-Output, log to C:CleanupReport.txt.