Batch Script to delete files older than specified date

Cleptography's Avatar author of Batch Script to delete files older than specified date
This is an article on Batch Script to delete files older than specified date in Programming.
Batch to delete files in a directory older than the specified date

Batch to delete files older than specified date
-----------------------------------------------------
Code:
@echo off
 setlocal

:---------------------------------------:
:                                       :
: Delete Files In The Current Directory :
:     Older Than The Specified Date     :
:                                       :
:---------------------------------------:

:: Set delete date
set _FileDate=%1

:: Check delete date arg if it does not exist goto :Usage
if not defined _FileDate goto Usage

:: Parse and set user date REM This is the date used to compare
for /f "tokens=1,2,3 delims=/" %%a in ("%_FileDate%") do (
	set "_Month=%%a"
		set "_Day=%%b"
			set "_Year=%%c"
)
:: Parse month and day of files and delete files older than date
for %%d in (*) do (
	for /f "tokens=1,2,3,6* delims=/ " %%e in ("%%~tnxd") do (
		if %%e leq %_Month% (
			if %%f leq %_Day% (
				if %%g leq %_Year% (
					del /f /q %%h
				)
			)
		)
	)
)
goto :eof

:Usage
echo.Usage:   %0 [Date of Files]
echo.
echo.Example: %0 %date:~4,2%/%date:~7,2%/%date:~10,4%
echo.
echo.Deletes: Files Created On Or Before %date:~4,2%/%date:~7,2%/%date:~10,4%
gregbaldwen's Avatar, Join Date: Sep 2010
Newbie Member
Indeed a good recommendation, anyway thanks for the code presented seems to be helpful in my site development for T1 Internet Service site project. Definitely a good resource.
Cleptography like this
kenprinceton's Avatar, Join Date: Sep 2010
Newbie Member
The code is quiet helpful in my internet T1 Price site project thanks for it.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
If you liked this article do nominate this article for Article of the month - Sep 2010 Before 15th of October 2010.