Home » Scripting (Automation) » Delete Old Files

Delete Old Files

Batch script to delete X days old file from specified location. Where is X is number of days.

@echo off
REM Remove files backup older than X days
Echo Deleting Bak file….
forfiles /p “Folder Path” /s /m *.bak /c “cmd /c Del @path” /d -X
Exit

Note:
Folder Path= Replace with target folder.
Replace X with no of days (Eg :3 for 3 days old)

Thanks,
WintelAdmin

Print Friendly

Leave a comment

Your email address will not be published. Required fields are marked *


1 + = 4


Visitors Count

Subscriber Count

    3813
March 2017
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
2728293031