20.05.2012
Main Menu
Photo Gallery
Online Profiles
* * Google AdSense * *

How to remove files older than x days

Go back to Knowledge Base

In some cases, it could be interesting to search and delete files older than a certain number of hours or days. These files could be logs, backup or anything else.

To do this, you need to write a batch file with the following command:

forfiles /p F:\Backup /s /m *.bak /d -3 /c "cmd /c del /q @file"

This command will look for any file named *.bak and older than 3 days, then delete it.

 

I hope this will help you to write easy scripts to maintain your systems.

Go back to Knowledge Base




* * * * * Did you like this page ? - - - Post it on your Facebook ! * * * * *
* * * * * Google Custom Search * * * * *
Last Updates
Help
Translate by Google
English French German Italian Portuguese Russian Spanish Swedish
Login Form

* * Current URL * *
Mobile Barcode
Visitors Stats
56.6%United States United States
10.8%Switzerland Switzerland
6%Canada Canada
4.8%India India
3.6%United Kingdom United Kingdom
3.6%Australia Australia
2.4%France France
2.4%Portugal Portugal
1.2%Indonesia Indonesia
1.2%Singapore Singapore

Stats by ExtraWatch