Задайте вопросЗадайте вопрос
 

ВопросScript to Sort folders into parent folders

  • 1 июля 2009 г. 17:44Mikedx Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    Scenario:

    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 "~John Smith" in the folder name, I use a little batch file like this for each parent folder:

    md "PoolA"
    for /f %%a in (PoolAList.txt) do (
    Move "*%%a*" "PoolA\%%a")

    This little script works very well but causes me to lose the "John Smith" in the folder name.

    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:
    1.  Create a new folder
    2.  Look at a .txt file with a bunch of numbers in it
    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)

    I'm hoping that this is as easy as I think it is.  Thanks in advance for any help!

Все ответы