<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Delete Files Older Than Date Using Batch Files</title>
	<atom:link href="http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/</link>
	<description>Tech, Love, Life</description>
	<lastBuildDate>Wed, 10 Feb 2010 22:16:26 -0800</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Rickmci</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-11905</link>
		<dc:creator>Rickmci</dc:creator>
		<pubDate>Mon, 01 Feb 2010 20:32:34 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-11905</guid>
		<description>Nice little helpfull hint. Saved me some time. Thanks from Texas!</description>
		<content:encoded><![CDATA[<p>Nice little helpfull hint. Saved me some time. Thanks from Texas!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Astorre</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-10695</link>
		<dc:creator>Astorre</dc:creator>
		<pubDate>Sat, 05 Dec 2009 22:51:41 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-10695</guid>
		<description>Thanks a lot !! 
very useful.</description>
		<content:encoded><![CDATA[<p>Thanks a lot !!<br />
very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henk</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-10393</link>
		<dc:creator>Henk</dc:creator>
		<pubDate>Wed, 18 Nov 2009 14:08:49 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-10393</guid>
		<description>Hey Scott,

thanks for the information. I was also searching for this. Got a couple of backup things that need special care. So this commandline tool came in handy. 

regards from holland

Henk</description>
		<content:encoded><![CDATA[<p>Hey Scott,</p>
<p>thanks for the information. I was also searching for this. Got a couple of backup things that need special care. So this commandline tool came in handy. </p>
<p>regards from holland</p>
<p>Henk</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marc</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-9078</link>
		<dc:creator>marc</dc:creator>
		<pubDate>Thu, 03 Sep 2009 18:25:51 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-9078</guid>
		<description>maybe...  below is the help screen fro the forfiles that I am using.  It clearly shows @FILE and @PATH as 2 distinct variables.  The all-uppercase requirement is not so clear but verified during testing.  I just brought it up because the delete example forfiles syntax did not match your test case example forfiles syntax (i.e. @PATH only vs. @PATH/@FILE) and I did not want anyone to delete more than they bargained for.

File Stats:
-rwxrwxrwx   1 user     group       12048 Sep  3 00:28 forfiles.exe

Help Screen:
FORFILES v 1.1 - emmanubo@microsoft.com - 4/98

Syntax : FORFILES [-pPath] [-mSearch Mask] [-ccommand] [-d] [-s]

 -pPath               Path where to start searching
 -mSearch Mask        Search files according to 
 -cCommand            Command to execute on each file(s)
 -d Select files with date &gt;= or = or &lt;= (current date - DD days)
 -s                   Recurse directories
 -v                   Verbose mode

The following variables can be used in Command :
 @FILE, @FNAME_WITHOUT_EXT, @EXT, @PATH, @RELPATH, @ISDIR, @FSIZE, @FDATE,
 @FTIME

To include special hexa characters in the command line : use 0xHH

Default :    
Examples :
FORFILES -pc:\ -s -m*.BAT -c&quot;CMD /C Echo @FILE is a batch file&quot;
FORFILES -pc:\ -s -m*.* -c&quot;CMD /C if @ISDIR==TRUE echo @FILE is a directory&quot;
FORFILES -pc:\ -s -m*.* -d-100 -c&quot;CMD /C Echo @FILE : date &gt;= 100 days&quot;
FORFILES -pc:\ -s -m*.* -d-01011993 -c&quot;CMD /C Echo @FILE is quite old!&quot;
FORFILES -pc:\ -s -m*.* -c&quot;CMD /c echo extension of @FILE is 0x22@EXT0x22&quot;

Thanks again.
--marc</description>
		<content:encoded><![CDATA[<p>maybe&#8230;  below is the help screen fro the forfiles that I am using.  It clearly shows @FILE and @PATH as 2 distinct variables.  The all-uppercase requirement is not so clear but verified during testing.  I just brought it up because the delete example forfiles syntax did not match your test case example forfiles syntax (i.e. @PATH only vs. @PATH/@FILE) and I did not want anyone to delete more than they bargained for.</p>
<p>File Stats:<br />
-rwxrwxrwx   1 user     group       12048 Sep  3 00:28 forfiles.exe</p>
<p>Help Screen:<br />
FORFILES v 1.1 &#8211; <a href="mailto:emmanubo@microsoft.com">emmanubo@microsoft.com</a> &#8211; 4/98</p>
<p>Syntax : FORFILES [-pPath] [-mSearch Mask] [-ccommand] [-d] [-s]</p>
<p> -pPath               Path where to start searching<br />
 -mSearch Mask        Search files according to<br />
 -cCommand            Command to execute on each file(s)<br />
 -d Select files with date &gt;= or = or &lt;= (current date &#8211; DD days)<br />
 -s                   Recurse directories<br />
 -v                   Verbose mode</p>
<p>The following variables can be used in Command :<br />
 @FILE, @FNAME_WITHOUT_EXT, @EXT, @PATH, @RELPATH, @ISDIR, @FSIZE, @FDATE,<br />
 @FTIME</p>
<p>To include special hexa characters in the command line : use 0xHH</p>
<p>Default :<br />
Examples :<br />
FORFILES -pc:\ -s -m*.BAT -c&#8221;CMD /C Echo @FILE is a batch file&#8221;<br />
FORFILES -pc:\ -s -m*.* -c&#8221;CMD /C if @ISDIR==TRUE echo @FILE is a directory&#8221;<br />
FORFILES -pc:\ -s -m*.* -d-100 -c&#8221;CMD /C Echo @FILE : date &gt;= 100 days&#8221;<br />
FORFILES -pc:\ -s -m*.* -d-01011993 -c&#8221;CMD /C Echo @FILE is quite old!&#8221;<br />
FORFILES -pc:\ -s -m*.* -c&#8221;CMD /c echo extension of @FILE is 0&#215;22@EXT0&#215;22&#8243;</p>
<p>Thanks again.<br />
&#8211;marc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-9061</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Thu, 03 Sep 2009 07:32:22 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-9061</guid>
		<description>Not sure what version of forfiles you have - but my Windows 2000 version worked as I wrote it.  Maybe yours was Windows 2003?</description>
		<content:encoded><![CDATA[<p>Not sure what version of forfiles you have &#8211; but my Windows 2000 version worked as I wrote it.  Maybe yours was Windows 2003?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marc</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-9058</link>
		<dc:creator>marc</dc:creator>
		<pubDate>Thu, 03 Sep 2009 07:04:36 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-9058</guid>
		<description>Very useful; forfiles.

However, shouldn&#039;t the first line read:

forfiles -pC:\backup -s -m*.* -d-5 -c &quot;cmd /c del /q @PATH\@FILE&quot;

...or all files would be deleted in the @PATH not the list of files over 5 days old such as @PATH/@FILE would result in?

Try this:
forfiles -pC:\backup -s -m*.* -d-5 -c &quot;cmd /c echo del /q @PATH&quot;

...echos a list of delete commands with the same (duplicate) path string (with no filename) for each file found in the directory over 5 days old) that was older than 5 days.

You Get This (duplicate directory only names, not desired):
del -q c:\backup\db2\
del -q c:\backup\db2\
del -q c:\backup\mssql\
del -q c:\backup\mssql\
del -q c:\backup\mssql\
del -q c:\backup\oracle\
del -q c:\backup\oracle\

NOTE: these (above) del commands would delete all files in these directories, not just the one over 5 days old

VS. this:
forfiles -pC:\backup -s -m*.* -d-5 -c &quot;cmd /c echo del /q @PATH/@FILE&quot;

You get This (desired):
del -q c:\backup\db2\file_01.zip
del -q c:\backup\db2\file_02.zip
del -q c:\backup\mssql\file_51.zip
del -q c:\backup\mssql\file_52.zip
del -q c:\backup\mssql\file_53.zip
del -q c:\backup\oracle\file_71.zip
del -q c:\backup\oracle\file_72.zip

NOTE: these (above, desired) del commands would the specifc files that are over 5 days old

Or am I missing something?

Also, the version of forfiles that I got requires @PATH, @FILE, etc. to be ALL uppercase (maybe my version?).

BTW.. thank you for turning me on to forfiles. :-)  does the job and is more strait forward than find&#124;xargs.

--marc</description>
		<content:encoded><![CDATA[<p>Very useful; forfiles.</p>
<p>However, shouldn&#8217;t the first line read:</p>
<p>forfiles -pC:\backup -s -m*.* -d-5 -c &#8220;cmd /c del /q @PATH\@FILE&#8221;</p>
<p>&#8230;or all files would be deleted in the @PATH not the list of files over 5 days old such as @PATH/@FILE would result in?</p>
<p>Try this:<br />
forfiles -pC:\backup -s -m*.* -d-5 -c &#8220;cmd /c echo del /q @PATH&#8221;</p>
<p>&#8230;echos a list of delete commands with the same (duplicate) path string (with no filename) for each file found in the directory over 5 days old) that was older than 5 days.</p>
<p>You Get This (duplicate directory only names, not desired):<br />
del -q c:\backup\db2\<br />
del -q c:\backup\db2\<br />
del -q c:\backup\mssql\<br />
del -q c:\backup\mssql\<br />
del -q c:\backup\mssql\<br />
del -q c:\backup\oracle\<br />
del -q c:\backup\oracle\</p>
<p>NOTE: these (above) del commands would delete all files in these directories, not just the one over 5 days old</p>
<p>VS. this:<br />
forfiles -pC:\backup -s -m*.* -d-5 -c &#8220;cmd /c echo del /q @PATH/@FILE&#8221;</p>
<p>You get This (desired):<br />
del -q c:\backup\db2\file_01.zip<br />
del -q c:\backup\db2\file_02.zip<br />
del -q c:\backup\mssql\file_51.zip<br />
del -q c:\backup\mssql\file_52.zip<br />
del -q c:\backup\mssql\file_53.zip<br />
del -q c:\backup\oracle\file_71.zip<br />
del -q c:\backup\oracle\file_72.zip</p>
<p>NOTE: these (above, desired) del commands would the specifc files that are over 5 days old</p>
<p>Or am I missing something?</p>
<p>Also, the version of forfiles that I got requires @PATH, @FILE, etc. to be ALL uppercase (maybe my version?).</p>
<p>BTW.. thank you for turning me on to forfiles. <img src='http://scottelkin.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   does the job and is more strait forward than find|xargs.</p>
<p>&#8211;marc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mc</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-8680</link>
		<dc:creator>mc</dc:creator>
		<pubDate>Fri, 21 Aug 2009 18:56:36 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-8680</guid>
		<description>gracias</description>
		<content:encoded><![CDATA[<p>gracias</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://scottelkin.com/programming/delete-files-older-than-date-using-batch-files/comment-page-1/#comment-8673</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 21 Aug 2009 11:05:20 +0000</pubDate>
		<guid isPermaLink="false">/archive/2007/04/13/Delete-Files-Older-Than-Date-Using-Batch-Files.aspx#comment-8673</guid>
		<description>Thanks for that. Forfiles FTW!

Just what I needed to clean up a load of cookies folders without wiping them out entirely. A nice little command.</description>
		<content:encoded><![CDATA[<p>Thanks for that. Forfiles FTW!</p>
<p>Just what I needed to clean up a load of cookies folders without wiping them out entirely. A nice little command.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
