So in the work of doing backups, I need a batch script that would allow me to delete files in a specified directory, that are older than lets say, 3 days. This script will be set as a scheduled task to run at a specified time every day.
“Delete Files Older Than” Batch Script
batch-filewindows-server-2008-r2
Related Topic
- Schedule a batch file with parameters containing spaces
- Windows Server – Why Scheduled Task Isn’t Running a Batch Script
- Find file newer than yesterday using batch script
- Windows – Scheduled service/script/batch file to move files on condition of other files with similar filenames in same directory on windows
- Task to delete a directory runs with success but the directory is still there
- Script for renaming files and adding a timestamp (server 2012 r2)
Best Answer
If powershell is acceptable (should be, as its enabled by default on Server 2008+) try this:
Souce here.