Script to Sort folders into parent foldersScenario:<br/> <br/> I have 500+ folders named with a distinct number and name (1234_John Smith) which need to be sorted into parent folders based upon a list that I have in an excel spreadsheet.  The only reliable match between the list and the folder names is the number.  For tasks where there is no &quot;~John Smith&quot; in the folder name, I use a little batch file like this for each parent folder:<br/> <br/> md &quot;PoolA&quot;<br/> for /f %%a in (PoolAList.txt) do (<br/> Move &quot;*%%a*&quot; &quot;PoolA\%%a&quot;)<br/> <br/> This little script works very well but causes me to lose the &quot;John Smith&quot; in the folder name.<br/> <br/> I am gathering that a .vbs script would better suit my need to actually move folders around but I know next to nothing on the subject.  Basically, I would like a script that I could place in the main directory (the one with all of the 1234_John Smith folders) which would:<br/> 1.  Create a new folder<br/> 2.  Look at a .txt file with a bunch of numbers in it<br/> 3.  Place all folders that correspond to a number in the .txt file into the created folder (without renaming the moved-folder in any way)<br/> <br/> I'm hoping that this is as easy as I think it is.  Thanks in advance for any help!© 2009 Microsoft Corporation. All rights reserved.Thu, 02 Jul 2009 12:29:11 Zed9495e8-469e-40e9-aa93-f7579b2d870fhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ed9495e8-469e-40e9-aa93-f7579b2d870f#ed9495e8-469e-40e9-aa93-f7579b2d870fhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ed9495e8-469e-40e9-aa93-f7579b2d870f#ed9495e8-469e-40e9-aa93-f7579b2d870fMikedxhttp://social.technet.microsoft.com/Profile/en-US/?user=MikedxScript to Sort folders into parent foldersScenario:<br/> <br/> I have 500+ folders named with a distinct number and name (1234_John Smith) which need to be sorted into parent folders based upon a list that I have in an excel spreadsheet.  The only reliable match between the list and the folder names is the number.  For tasks where there is no &quot;~John Smith&quot; in the folder name, I use a little batch file like this for each parent folder:<br/> <br/> md &quot;PoolA&quot;<br/> for /f %%a in (PoolAList.txt) do (<br/> Move &quot;*%%a*&quot; &quot;PoolA\%%a&quot;)<br/> <br/> This little script works very well but causes me to lose the &quot;John Smith&quot; in the folder name.<br/> <br/> I am gathering that a .vbs script would better suit my need to actually move folders around but I know next to nothing on the subject.  Basically, I would like a script that I could place in the main directory (the one with all of the 1234_John Smith folders) which would:<br/> 1.  Create a new folder<br/> 2.  Look at a .txt file with a bunch of numbers in it<br/> 3.  Place all folders that correspond to a number in the .txt file into the created folder (without renaming the moved-folder in any way)<br/> <br/> I'm hoping that this is as easy as I think it is.  Thanks in advance for any help!Wed, 01 Jul 2009 17:44:09 Z2009-07-01T17:44:09Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ed9495e8-469e-40e9-aa93-f7579b2d870f#87fd2de8-c2a9-4f91-9de6-d5fe19d7459fhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ed9495e8-469e-40e9-aa93-f7579b2d870f#87fd2de8-c2a9-4f91-9de6-d5fe19d7459fSalvador Manaois IIIhttp://social.technet.microsoft.com/Profile/en-US/?user=Salvador%20Manaois%20IIIScript to Sort folders into parent foldersYou can actually skip the file name in the destination of your MOVE call:<br/><br/>md &quot;PoolA&quot;<br/>for /f %%a in (PoolAList.txt) do (<br/>Move &quot;*%%a*&quot; &quot;PoolA&quot;)<br/><br/>This should retain the whole file name, you won't lose the &quot;Josh Smith&quot; as in your example above.<br/><br/>Regards,<br/><br/><strong>Salvador Manaois III<br/></strong>MCITP | <em>Enterprise &amp; Server Administrator<br/></em>MCSE MCSA MCTS(x5) CIWA C|EH <br/>My Blog: <a href="http://badzmanaois.blogspot.com/"><span style="color:#0033cc"><strong>Bytes and Badz</strong></span></a> <br/>My Shots: <a href="http://social.technet.microsoft.com/Forums/en-US/user/flickr.com/photos/badzmanaois"><span style="color:#0033cc"><strong>View My PhotoStream</strong></span></a>Thu, 02 Jul 2009 03:32:07 Z2009-07-02T03:32:07Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ed9495e8-469e-40e9-aa93-f7579b2d870f#69942fd2-d07b-4449-ac55-7e6229b2ac9chttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/ed9495e8-469e-40e9-aa93-f7579b2d870f#69942fd2-d07b-4449-ac55-7e6229b2ac9cMikedxhttp://social.technet.microsoft.com/Profile/en-US/?user=MikedxScript to Sort folders into parent foldersSalvador,<br/> <br/> Thank you for responding!<br/> <br/> I tried what you suggested but am getting an error in the command window:  &quot;The filename, directory name or volume label syntax is incorrect.&quot;  I think the problem is that I am attempting to move folders/directories (and the files contained therein) and not files?  My understanding is that I couldn't actually &quot;move&quot; directories with a batch file - that I could only rename the directory... the problem being that I need to retain the rest of the directory name when moving.<br/> <br/> Any further advice would be MUCH appreciated.<br/> <br/> Thank you again,<br/> MikeThu, 02 Jul 2009 12:29:11 Z2009-07-02T12:29:11Z