Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

xcopy using a text file to a folder

Avatar of David Izen
David Izen asked on
Microsoft DOSWindows OSWindows Batch
13 Comments1 Solution1239 ViewsLast Modified:
Hi guys

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

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?