We help IT Professionals succeed at work.

Batch file to copy certain files from list to destination preserving directory structure, robocopy?

1,341 Views
Last Modified: 2008-01-09
I have a list of files that I would like to create a batch file using copy, xcopy, xxcopy or robocopy. I have tried all of the above and can't seem to figure a way to preserve the file path. I need to copy only the files in the list and to create the directory structure as it exists in the source.

I have tried copy g:\dir1\dir1001\filename g:\copydir1\dir1001\filename

all of these assume the file name is also a directory, robocopy seems to allow placing the file name on a separate line in the batch file but I can't seem to get that right either.

running XP pro SP2, I have cygin available if there is something that will work.
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.