troubleshooting Question

xcopy using a text file to a folder

Avatar of David Izen
David Izen asked on
Windows BatchMicrosoft DOSWindows OS
13 Comments2 Solutions1239 ViewsLast Modified:
Hi guys

I have a text file with full file paths, listed like this example below:

G:\folder\support_team\example.pdf
G:\folder2\work centre\example.docx

and so on.

I want to use this text file so I can copy these specific files to a destination folder on a different disk, keeping the folder structure. The files are coming from an external hard drive (plugged into a server via USB) and need to be copied over to a different disk in a folder of my choice which is on the local server.

These are a list of files where they exceeded Windows 255 character limit when I did a copy of data so I'm hoping a script will also bypass that limitation.

I was trying to a variation of the below:

set src_folder=c:\whatever\
set dst_folder=c:\whatever\
for /f %%i in (File-list.txt) DO xcopy /S/E/U "%src_folder%\%%i" "%dst_folder%"

But having 0 success and just getting errors in CMD. This is for a Windows OS environment.

Can anyone help me out please?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros