Copying Folders and Files From A List in Command Prompt

I had a unique request to copy a list of folders out of a greater collection of folders. Seeking the best way to do this I found this solution thanks to sidesofmarch:

Step 1:

Create a text (ex: migrate.txt) file containing a list of folders to be copied or moved, each folder name on a new line.

Step 2:

Run a for/in loop while inside the Windows Command Prompt. Add the /move attribute to robocopy to move instead of copy. Google “robocopy” for more options. In this example %i is the folder name which copies it to the root of E: drive.

for /f "delims=" %i in (migrate.txt) do robocopy "%i" "E:\%i" /e /z /MT /log+:log.txt

Note: if you put this command in a batch file use %%i instead of %i

Tested 7/29/2015 on Windows 10