Robocopy to reference a text file

Robocopy

Can someone please give me a script that allows me to robocopy a lot of directories from a source to a destination while referencing the directory names listed in a text file
The list will be in c:\scripts
doctorbillTechAsked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Sadly, RoboCopy has no option to allow for providing a list of folders. You have to use a batch file, copying one folder each time.
I'm assuming your file contains both source and destination paths, separated by a comma:
@echo off
for /f "tokens=1-2 delims=," %%A in (C:\Scripts\Folders.txt) do robocopy %%A %%B /S /R:1 /W:1

Open in new window

1
 
doctorbillTechAuthor Commented:
The file just has the file name from the source

So should this be the format:
\\isi-sbs2011\File1,e:\isi-data\File1
\\isi-sbs2011\File2,e:\isi-data\File2
\\isi-sbs2011\File3,e:\isi-data\File3
etc......
0
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
Yes, you still need to do the other parts
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
doctorbillTechAuthor Commented:
what parts are those
0
 
NVITCommented:
Save your list as C:\Scripts\Folders.txt:
\\isi-sbs2011\File1,e:\isi-data\File1
\\isi-sbs2011\File2,e:\isi-data\File2
\\isi-sbs2011\File3,e:\isi-data\File3

Open in new window

Then run Qlemo's code.
0
 
doctorbillTechAuthor Commented:
ok - will try it
0
 
doctorbillTechAuthor Commented:
sorry - does not work
0
 
NVITCommented:

sorry - does not work
is not very helpful for us.

How did you run it?
1. Change the code to:
@echo off
for /f "tokens=1-2 delims=," %%A in (C:\Scripts\Folders.txt) do ECHO robocopy %%A %%B /S /R:1 /W:1

Open in new window

2. Save it to a file like test.cmd
2. Open a CMD window
3. Run test.cmd
4. Copy and pasted the CMD window text here for us to review.
1
 
ReneGeCommented:
@DoctorBill

In:
\\isi-sbs2011\File1,e:\isi-data\File1

\\isi-sbs2011\File1 is source folder?
e:\isi-data\File1 is destination folder?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.