<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Automatic file maintenance under XP?</title>
	<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP/</link>
	<description>Comments on Ask MetaFilter post Automatic file maintenance under XP?</description>
	<pubDate>Sat, 25 Mar 2006 18:38:05 -0800</pubDate>
	<lastBuildDate>Sat, 25 Mar 2006 18:38:05 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Automatic file maintenance under XP?</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP</link>	
		<description>I&apos;m looking for some software to be run under Windows XP that I can set to move or remove files which are past a certain date after specified intervals.  Ideally the software will have a small footprint and relatively easy to use.  Is this the sort of task that can be done through some sort of Windows based CRON program?

Ahhhh help me Mefi!</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.35075</guid>
		<pubDate>Sat, 25 Mar 2006 18:03:18 -0800</pubDate>
		<dc:creator>a.</dc:creator>
		
			<category>windows</category>
		
			<category>xp</category>
		
			<category>file</category>
		
			<category>maintenance</category>
		
	</item> <item>
		<title>By: ChasFile</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546382</link>	
		<description>&lt;em&gt;past a certain date after specified intervals.&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
I don&apos;t get it.  Files that are older than a certain interval period, like in a temp directory, or files that are set to delete at a certain datetime, like cookies, or all the files created or modified during a certain interval, like a system restore, or what?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546382</guid>
		<pubDate>Sat, 25 Mar 2006 18:38:05 -0800</pubDate>
		<dc:creator>ChasFile</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546387</link>	
		<description>The Windows equivalent of &lt;strong&gt;cron&lt;/strong&gt; is &lt;strong&gt;AT&lt;/strong&gt;, right?&lt;br&gt;
&lt;br&gt;
According to &lt;a href=&quot;http://www.iopus.com/guides/winscheduler.htm&quot;&gt;this helpful page&lt;/a&gt; it&apos;s got a nice interface/GUI controller called Windows Task Scheduler.&lt;br&gt;
&lt;br&gt;
So, all you need to do now is write a batch file which accomplishes your file deletion task, which is a bit obscure at the moment.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546387</guid>
		<pubDate>Sat, 25 Mar 2006 18:44:07 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item><item>
		<title>By: a.</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546394</link>	
		<description>Yup Chas, like in a temp directory.  Life would be so much easier if you didn&apos;t need to manually clear it out yourself.  I had a quick look at the Windows Task Scheduler, but i knew i would end up needing to use a batch file.  Its been so long since i&apos;ve played with them, and other than being a little messy with a command window opening in the middle of working i now wouldnt know how to script this task using them anyway.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546394</guid>
		<pubDate>Sat, 25 Mar 2006 19:07:36 -0800</pubDate>
		<dc:creator>a.</dc:creator>
	</item><item>
		<title>By: harmfulray</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546399</link>	
		<description>If you install &lt;a href=&quot;http://cygwin.com&quot;&gt;Cygwin&lt;/a&gt; you will have access to a multitude of standard Unix utilities from Windows, including the invaluable &lt;a href=&quot;http://unixhelp.ed.ac.uk/CGI/man-cgi?find&quot;&gt;find&lt;/a&gt;.  Find is a general utility to traverse file systems, pick out files that meet criteria you specify (such as &quot;created more than 7 days ago&quot;) and optionally perform operations on them (such as &quot;delete&quot; or &quot;copy to backup directory&quot;).  &lt;br&gt;&lt;br&gt;For example,&lt;br&gt;
&lt;blockquote&gt;&lt;pre&gt;find ./ -ctime +7 -exec rm -f {} \; -ls&lt;/pre&gt;&lt;/blockquote&gt;This should print the names of and delete all files within or under the root directory created more than 7 days ago.  Cygwin also includes a cron utility so it would be rather straightforward to accomplish your goal this way if I understand your question correctly.  (Be aware that you should be very sure that the logic embodied in your predicates is correct when executing &lt;i&gt;rm -f&lt;/i&gt; in an automated fashion :)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546399</guid>
		<pubDate>Sat, 25 Mar 2006 19:10:37 -0800</pubDate>
		<dc:creator>harmfulray</dc:creator>
	</item><item>
		<title>By: harmfulray</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546402</link>	
		<description>Oops, I meant &quot;under the current directory&quot; and not &quot;under the root directory&quot; for that example.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546402</guid>
		<pubDate>Sat, 25 Mar 2006 19:12:07 -0800</pubDate>
		<dc:creator>harmfulray</dc:creator>
	</item><item>
		<title>By: hincandenza</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546515</link>	
		<description>Argh- another one of these &quot;install Cygwin!&quot; answers.  People, people, people- Windows has plenty of batchin&apos; capabilites if you only learn &lt;i&gt;how&lt;/i&gt;!  It seems that every single &quot;I&apos;m trying to batch something in windows&quot; question has at least one &quot;install a package of utilies, so you can do it the Unix way!&quot; answer.&lt;br&gt;
&lt;br&gt;
When I&apos;ve dealt with this problem in the past (&lt;i&gt;for example, auto-cleaning web log directories of anything older than 30 days&lt;/i&gt;) I&apos;ve most commonly used &lt;b&gt;forfiles.exe&lt;/b&gt;, which comes standard on some of the MS OSes although I don&apos;t think it&apos;s there on XP.  However, it can be found in the (free) reskits, or easier if you just want the one file instead of a big install package you can search around for a copy on the net and dump it in your c:\windows\system32\ directory.  If you know anyone with a copy of Windows 2003 you can get it from them, too.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;&lt;u&gt;Forfiles.exe command/batch file&lt;/u&gt;&lt;/b&gt;&lt;br&gt;
Once you have a copy of forfiles.exe you write a simple batch file- pretty much one line:&lt;br&gt;
&lt;blockquote&gt;&lt;code&gt;forfiles /P PATHTOFOLDER /S /D -30 /M *.* /C &quot;cmd /C del @path /Q&quot;&lt;/code&gt;&lt;/blockquote&gt;&lt;br&gt;
Where PATHTOFOLDER is the full path to the directory in question (&lt;i&gt;c:\windows\temp in your case?&lt;/i&gt;), the /S means &quot;... and all subdirectories&quot; if desirable, and the -30 after /D is &quot;older than 30 days&quot;; you can change to -10 if you want 10 days, etc.  /M is file mask (*.* for all files) and /C is the command you&apos;d run on any file matching these parameters, in this case &quot;delete&quot; with the /Q switch to avoid prompting.&lt;br&gt;
&lt;br&gt;
Also, in some cases you may want it to get rid of &lt;i&gt;folders&lt;/i&gt; as well, in which case you can add a second command to use /C &quot;cmd /C rd @path /Q&quot; at the end instead of the del @path /Q, which should quietly error out on non-folders but otherwise remove old folders after the files have been cleaned up.  That might make your batch file look like this:&lt;blockquote&gt;&lt;code&gt;forfiles /P PATHTOFOLDER /D -30 /M *.* /C &quot;cmd /C del @path /Q&quot;&lt;br&gt;
forfiles /P PATHTOFOLDER /S /D -30 /M *.* /C &quot;cmd /C rd @path /Q&quot;&lt;/code&gt;&lt;/blockquote&gt;Try this on a &lt;i&gt;&lt;b&gt;copy&lt;/b&gt;&lt;/i&gt;&lt;/b&gt; of a folder first to test it out... I can&apos;t stress this enough, copy some folder to c:\TEST or something, and try all your batch jobs out there as the PATHTOFOLDER, so you&apos;re sure you&apos;ve done the syntax as I have above and it works... &lt;i&gt;&lt;b&gt;before&lt;/b&gt;&lt;/i&gt;&lt;/b&gt; you point it at any actual directory for the love of god and all that is holy.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;&lt;u&gt;Schedule in AT or task manager&lt;/u&gt;&lt;/b&gt;&lt;br&gt;
Save this command line in a simple text CleanTemp.bat file using notepad- you can repeat the line multiple times in the CleanTemp.bat file if you want to do this with more than one folder as a target, or using the &quot;remove directory&quot; example I mentioned above.  Every time you run it, it&apos;ll execute those commands in the background.  Then have that scheduled to run via task scheduler and it&apos;s GUI, or the AT command at a command propmt, whichever is simpler for you.  Ex:&lt;blockquote&gt;&lt;code&gt;at 9:00a /every:Su,M,T,W,Th,F,S c:\scripts\CleanTemp.bat&lt;/code&gt;&lt;/blockquote&gt;where c:\scripts\cleantemp.bat is the full path to the batch file.  This will run it automatically at 9am every single day.  You can type AT at the command line with no arguments to see any existing schedule jobs.  Adjust to taste, add seasoning.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546515</guid>
		<pubDate>Sat, 25 Mar 2006 23:01:39 -0800</pubDate>
		<dc:creator>hincandenza</dc:creator>
	</item><item>
		<title>By: a.</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546534</link>	
		<description>Ahhhh I think that looks more like what I&apos;m after hincandenza! the cygwin tip was close... but I must admit that I&apos;m glad I don&apos;t need to go there.&lt;br&gt;
&lt;br&gt;
The purpose of the question was for a folder on the desktop I&apos;m calling &quot;Transitory&quot; to save files to when I know that after a while i wont need them like setup files, formatted images that are being uploaded etc. The chances are that if I havn&apos;t grabbed the files out of that directory after 30 days, i won&apos;t be needing them... and its crazy to manually sort through the directory when this task is better suited to the computer.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546534</guid>
		<pubDate>Sat, 25 Mar 2006 23:37:31 -0800</pubDate>
		<dc:creator>a.</dc:creator>
	</item><item>
		<title>By: cps</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546538</link>	
		<description>...&quot;manually&quot;?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546538</guid>
		<pubDate>Sat, 25 Mar 2006 23:47:03 -0800</pubDate>
		<dc:creator>cps</dc:creator>
	</item><item>
		<title>By: a.</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#546541</link>	
		<description>&lt;a href=&quot;http://dictionary.reference.com/search?q=manually&quot;&gt;manually&lt;/a&gt;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-546541</guid>
		<pubDate>Sat, 25 Mar 2006 23:57:20 -0800</pubDate>
		<dc:creator>a.</dc:creator>
	</item><item>
		<title>By: cps</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#547168</link>	
		<description>I understand the word, but wasn&apos;t sure what you mean by it here.  In case you were manually going through the list to find each one older than 30 days: &lt;br&gt;
&lt;br&gt;
You can sort by date by clicking the Date Modified column header in Explorer (in detail view, View-&amp;gt;Details).  This will sort the files from oldest to newest.  Select the block of oldest files by either a) clicking the first one and shift-clicking the last one you want to delete or b) dragging a box around them; then hit Delete.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-547168</guid>
		<pubDate>Sun, 26 Mar 2006 23:50:10 -0800</pubDate>
		<dc:creator>cps</dc:creator>
	</item><item>
		<title>By: a.</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#547177</link>	
		<description>Wouldn&apos;t be so much better if the computer did it itself? What I&apos;m trying to do is make a folder with a 30 day file buffer, and if I were to do all that myself I&apos;d no doubt give up especially since its really unnecessary to process it manually.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-547177</guid>
		<pubDate>Mon, 27 Mar 2006 00:11:47 -0800</pubDate>
		<dc:creator>a.</dc:creator>
	</item><item>
		<title>By: cps</title>
		<link>http://ask.metafilter.com/35075/Automatic-file-maintenance-under-XP#547217</link>	
		<description>Agreed, the automatic self-cleansing folder is neater.  But every now and then going in a folder and deleting the top X oldest files doesn&apos;t sound &quot;crazy&quot; to me, unless you were picking the files one by one.  &lt;br&gt;
&lt;br&gt;
Any case, you&apos;ve got a good solution above, so all&apos;s well that ends well.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.35075-547217</guid>
		<pubDate>Mon, 27 Mar 2006 02:05:54 -0800</pubDate>
		<dc:creator>cps</dc:creator>
	</item>
	</channel>
</rss>
