A command line utility to automatically delete files based on their age

DelByDays is a command line utility that allows you to automatically delete files from any directory based purely on their age. A good example of its use would be in your nightly backup script to automatically delete any previous backup files that were more than ten days old.

It includes a "WhatIf" switch so that you can test that it detects the correct files without actually deleting them.

It also allows you to specify that a logfile be created - you could include this in your email backup report.



You can download the latest build of DelByDays from the Downloads section.



Once you've downloaded from the Downloads section, unzip it to somewhere in your path (eg your Windows folder).

Then simply call DelByDays.exe from your batch file. The syntax is as follows:

DelByDays [path and file mask] [age in days] [-WhatIf] [-Log logfile]

[path and file mask] 

The full path to the folder, and the files that you want to be deleted. You can use wildcards to specify all files (*.*), or just files with a specific extension (*.bak), or files that contain a specific string (mailserver*.bak).

Example: "c:\server backups\*.bak"

 [age in days] A whole number. Files older than the specified number of days will be deleted.
 [-WhatIf] Specifies that the program will only display a list of files that match your criteria. No files will actually be deleted. You can use this to test your syntax prior to including it in your batch file.
 [-Log logfile] Specifies that a logfile is created at the specified location (full path and filename). If no path of filename is specified then a log called DelByDays.log will be created in the current user's My Documents folder.



DelByDays C:\Backups\*.* 7
Deletes all files in C:\Backups that are older than 7 days

DelByDays "D:\Backup Files\*.bak" 30 -WhatIf -Log "D:\Logs\DelByDays.log"
Displays a list of all files in D:\Backup Files that end in .bak and that are older than 30 days. It also creates a logfile called DelByDays.log in the D:\Logs folder.



DelByDays requires Microsoft .NET Framework 2.0 or greater. It runs on Windows 2000, XP, Vista, Windows 7, Windows Server 2003, 2008, 2008 R2, including both 32-bit and 64-bit editions. It is a command line application that doesn't require any installation or setup, other than copying the extracted EXE-file to somewhere in your path.


Copyrights and other information:

DelByDays is copyright Richard T.A. Neal, 2011-2012. It may not be given, sold, or otherwise distributed without prior written approval from the author. Please do not offer this product for download from your own website, instead you should reference the download link (above) to ensure that the most recent version and build is always downloaded.

No warranty, express or implied, is offered. No guarantee is made of the suitability of this software for any purpose whatsover. It is installed and used entirely at the user's risk. The author accepts no responsibility or liability for any circumstances resulting from the use of this software. By downloading and installing the software you are hereby agreeing to these terms.

The terms "Microsoft .NET Framework", and "Windows 2000, XP, Vista, Windows 7, Windows Server 2003, 2008, 2008 R2" refer to software packages and/or operating systems produced by Microsoft Corporation. Some or all of these terms may be trademarked by Microsoft, and these trademarks are hereby recognised and acknowledged.

Quick Links
Get the latest version here
Other Software

MailFlow Monitor
Monitor emails as they flow through your Microsoft Exchange server in real time

Shutdown Manager
Manage controlled shutdowns and restarts of your Hyper-V Hosts and Guests