Page 1 of 1

Batch file to copy folders & files except few

Posted: 12 Jul 2018 07:10
by anupam
Hello All Expert,

Looking for a batch file which should copy all folders & files except few to another named folder .

Lets say I have folder1 having 3 folders A , B , C and 2 file1 , file2 where each folder A, B and C has some more files & folders.

So I need to copy entire content of A , B and File1 to another folder leaving folder C and file2.

Could someone please advise Many thanks.

Re: Batch file to copy folders & files except few

Posted: 13 Jul 2018 06:58
by pieh-ejdsch
Hello anupam,
With xCopy /s folder1\file1 destination /exclude:list.txt
.. you can give a list with excluded paths.
See also xCopy /?

Phil

Re: Batch file to copy folders & files except few

Posted: 13 Jul 2018 07:56
by SIMMS7400
Pieh's suggestion is great because it's cleaner as you can include your exclusions in a file. but this also works if you dont have many:

Code: Select all

ROBOCOPY /E  "%SOURCE%" "%TARGET%" /XD Logs Errors Files /XF *.log *.err *.txt