<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://192.168.2.20/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>David Overton's Blog : Windows XP, Word, Windows Vista, Office System</title><link>http://192.168.2.20/blogs/doverton/archive/tags/Windows+XP/Word/Windows+Vista/Office+System/default.aspx</link><description>Tags: Windows XP, Word, Windows Vista, Office System</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>How to copy or archive files by year using the command line and robocopy</title><link>http://192.168.2.20/blogs/doverton/archive/2009/05/06/how-to-copy-or-archive-files-by-year-using-the-command-line-and-robocopy.aspx</link><pubDate>Wed, 06 May 2009 10:26:00 GMT</pubDate><guid isPermaLink="false">72050d9c-4f41-4a16-9f70-ebbf2c98a2c7:8433</guid><dc:creator>David Overton</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://192.168.2.20/blogs/doverton/rsscomments.aspx?PostID=8433</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://192.168.2.20/blogs/doverton/commentapi.aspx?PostID=8433</wfw:comment><comments>http://192.168.2.20/blogs/doverton/archive/2009/05/06/how-to-copy-or-archive-files-by-year-using-the-command-line-and-robocopy.aspx#comments</comments><description>&lt;p&gt;I got this question via e-mail and decided I would post the answer here in a blog.&amp;nbsp; (Updated 16th Feb 2017 with a typo correction)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I want transfer all files created in Office Word 2003 by year (annual batchs - ex: 2005, 2006, etc.) to external HD. How can to do this?&lt;/p&gt;
&lt;p&gt;I will appreciate your answer.&lt;/p&gt;
&lt;p&gt;Edgar &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To do this via the command line you can use Robocopy which is present in Windows Vista and Windows 7.&amp;nbsp; If you have Windows XP &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&amp;amp;displaylang=en" target="_blank"&gt;download the Server 2003 Resource Toolkit&lt;/a&gt; and install it.&amp;nbsp; Robocopy will be part of the install and found in the install directory.&lt;/p&gt;
&lt;p&gt;The actual command would look like this and would need to be entered into a command prompt:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;for /L %x in (2009,-1,2000) do robocopy &lt;em&gt;source destination&lt;/em&gt;\%x *.doc? /maxage:%x0101 /minage:%x1231 /s&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To break it down a bit..&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family:Courier New;"&gt;for /L %x in (2009,-1,2000) do&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This creates a counter from 2009 up in steps of -1 (or down in steps of 1) until 2000 is reached.&amp;nbsp; Each time the counter changes it is set into %x, so %x will become 2009, 2008 and so on.&amp;nbsp; It then executes the command after to &amp;quot;do&amp;quot;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family:Courier New;"&gt;robocopy &lt;em&gt;source destination&lt;/em&gt;\%x *.doc? /minage:%x0101 /maxage:%x1231 /s&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The robocopy command is very flexible.&amp;nbsp; Details of it can be found on the wiki page &lt;a href="http://en.wikipedia.org/wiki/Robocopy" target="_blank"&gt;here&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The first two parameters are the sounce and destination locations.&amp;nbsp; so it might be c:\users\david\documents and F:\document_backup.&amp;nbsp; Note the \%x on the end.&amp;nbsp; This means it will put the files inside a folder on the destination location that matches the year you are archiving.&lt;/li&gt;
&lt;li&gt;*.doc? is a limiter to the files to be copied - if you want all files, simply remove it.&amp;nbsp; This will copy all Office 2003 and 2007 document files - if you only want Office 2003, use *.doc and don&amp;#39;t include the question mark.&lt;/li&gt;
&lt;li&gt;The minage and maxage state how old the file is.&amp;nbsp; It can either be in days or a date in the form of yyyymmdd.&amp;nbsp; So with the %x set to 2009, the command will have /minage:20090101 /maxage:20091231 which equates to everything in 2009 and so on.&lt;/li&gt;
&lt;li&gt;The /s copies all subdirectories too&lt;/li&gt;
&lt;li&gt;You can optionally put the /MOV (to move the files) or /MOVE (to move all files and empty directories) command on the end.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope that helps&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:edc49fa0-df30-4cdb-b2db-5e6399cda500" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Windows" rel="tag"&gt;Windows&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Microsoft" rel="tag"&gt;Microsoft&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Robocopy" rel="tag"&gt;Robocopy&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Command+Line" rel="tag"&gt;Command Line&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Archiving" rel="tag"&gt;Archiving&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Office+2007" rel="tag"&gt;Office 2007&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Word" rel="tag"&gt;Word&lt;/a&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://192.168.2.20/aggbug.aspx?PostID=8433" width="1" height="1"&gt;</description><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Office+System/default.aspx">Office System</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Windows+Client/default.aspx">Windows Client</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Windows+XP/default.aspx">Windows XP</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Word/default.aspx">Word</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Tips/default.aspx">Tips</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Windows+Vista+and+XP/default.aspx">Windows Vista and XP</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Windows+Vista/default.aspx">Windows Vista</category><category domain="http://192.168.2.20/blogs/doverton/archive/tags/Vista+and+XP/default.aspx">Vista and XP</category></item></channel></rss>