Xcopy help please

J

Jack Gillis

I have an old fashioned batch file I use very often under XP to do a backup
of My
Documents to a USB Flash Drive.

It contains, among other things, this statement and works just fine and has
so for years.

xcopy "d:\My Documents\*.*" "U:\My Documents\" /D /Y /s

I have added many MP3 files to My Music and there is not room for them on
the USB Drive. Have tried to use the /EXCLUDE parameter tacked on to the
end of the statement but cannot get it to work. I keep getting 'parse' error
or 'Cannot find the files I a trying to exclude.

Will someone help me exclude My Documents\My Music from the copying, please?

Thank you.
 
P

Pegasus \(MVP\)

Jack Gillis said:
I have an old fashioned batch file I use very often under XP to do a backup
of My
Documents to a USB Flash Drive.

It contains, among other things, this statement and works just fine and
has
so for years.

xcopy "d:\My Documents\*.*" "U:\My Documents\" /D /Y /s

I have added many MP3 files to My Music and there is not room for them on
the USB Drive. Have tried to use the /EXCLUDE parameter tacked on to the
end of the statement but cannot get it to work. I keep getting 'parse'
error
or 'Cannot find the files I a trying to exclude.

Will someone help me exclude My Documents\My Music from the copying,
please?

Thank you.
Try this:

xcopy /D /Y /s /c "d:\My Documents\*.*" "U:\My Documents\"
/exclude:c:\Exclude.txt

The file c:\Exclude.txt must contain the string .MP3 (and perhaps
others too).
 
J

Jack Gillis

Pegasus (MVP) said:
Try this:

xcopy /D /Y /s /c "d:\My Documents\*.*" "U:\My Documents\"
/exclude:c:\Exclude.txt

The file c:\Exclude.txt must contain the string .MP3 (and perhaps
others too).

Thank you very much. I didn't realize the argument for the /EXCLUDE
parameter was supposed to be a file name. I misread the Xcopy /? on that
point.
 
P

Pegasus \(MVP\)

Jack Gillis said:
Thank you very much. I didn't realize the argument for the /EXCLUDE
parameter was supposed to be a file name. I misread the Xcopy /? on that
point.

I didn't either until I tried it myself. Thanks for the feedback.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top