Xcopy Command excluding files and folders

sohel14_cse_ju picture sohel14_cse_ju · Sep 10, 2012 · Viewed 107.2k times · Source

I want to copy files and folders in a directory to another folder excluding a list of files and folders.Is that possible.

I was just trying to copy excluding file :

 xcopy c:\t1 c:\t2 /EXCLUDE:exclusion.txt

But it keeps saying read cant read file : exclusion.txt

Can anyone help me on this?

Thanks

Answer

Techchrish picture Techchrish · Jan 30, 2014

Just give full path to exclusion file: eg..

-- no - - - - -xcopy c:\t1 c:\t2 /EXCLUDE:list-of-excluded-files.txt

correct - - - xcopy c:\t1 c:\t2 /EXCLUDE:C:\list-of-excluded-files.txt

In this example the file would be located " C:\list-of-excluded-files.txt "

or...

correct - - - xcopy c:\t1 c:\t2 /EXCLUDE:C:\mybatch\list-of-excluded-files.txt

In this example the file would be located " C:\mybatch\list-of-excluded-files.txt "

Full path fixes syntax error.