For those of you unfamiliar with robocopy, its a copy utility on Windows 7 that has many, many options to copy files and folders from local drives, mapped drives and even UNC paths to a destination path. If you are an old DOS guy like me, just think of xcopy on steroids.
Here is the code:
@echo offfor /F "tokens=*" %%A in (dirlist.txt) do (robocopy Y:\%%~A\ Y:\%%~A\ /E /R:1 /W:1 /COPY:DATS)
Save this to a bat file (ie, copy2dir.bat) and run the bat file. Lets go over the script:
dirlist.txt is where you will put the folder names (new line for each one)
The script will take each line in the txt file, look for a corresponding folder and then copy it to the destination folder. In my case I mapped a shared drive to my Y: drive letter and used that. You could use a UNC path or local drive letter as well.
Robocopy has MANY options. Do a robocopy /? at the command prompt and you will get a listing. The options I chose were:
/E - This copies sub directories, even empty ones.
/R:1 - Retry files only 1 time. the default is literally 1 million times!
/W:1 - Wait only 1 second between tries. Default is 30 seconds
/COPY:DATS - this copies Data, Attributes, Timestamps and Security (NTFS ACLs)
You have many more options to chose from including logging.
Hopefully you may find a use for this simple script.