Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcopy Command excluding files and folders [duplicate]

Tags:

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

like image 926
sohel14_cse_ju Avatar asked Sep 10 '12 17:09

sohel14_cse_ju


People also ask

Does xcopy Skip existing files?

xcopy cannot be configured to SKIP existing files, so you should copy using "robocopy".

How do I stop xcopy asking file or directory?

Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory. You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.

What option allows you to copy all the files and directories including the empty directories?

To do so, run the Xcopy command with /T switch. Using the /T switch will cause Xcopy to copy only the directory tree structure to the destination but ignores the empty directories. You can also add the /E switch to the command to include empty directories, as shown in the example command below.

Can xcopy copy directories as well?

MS-DOS and Windows command line By default, the basic xcopy command only copies files in the directory you specify as the source directory. You must use the /E option to copy subdirectories in the source directory as well.


1 Answers

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.

like image 113
Techchrish Avatar answered Oct 03 '22 19:10

Techchrish