Cleans up a Folder by moving the files older than N days to a temporary location. After N+M days the files are permanently deleted It also sends an HTML report via email with the listo of files moved and deleted
- Download the files
- In CleanUpFolder.ps1 set the variables according to your necessities
- In Send-ToEmail.ps1 configure SMTP parameters in order to send the email report
- Execute with powershell
- Enjoy
To execute this script as a scheduled task:
- Open TaskManager and select Create Basic task
- Enter a Name and a Description (optional)
- Choose the Trigger (ie. Weekly)
- In Action choose "Start a Program"
- In Program enter: Powershell.exe
- In Arguments enter: -nologo -noprofile -noninteractive -ExecutionPolicy Bypass -File U:\Complete\Path\CleanUpFolder.ps1
Roberto Figueroa
Unlicensed