Solved

Backup script avoid My Music

Posted on 2008-06-16
6
175 Views
Last Modified: 2010-04-16
I want to backup all in Mydocument on everyone's computer, so I wrote the following batch file:

xcopy "%userprofile%\My Documents\*.*"   "I:\Backup\"   /c/f/h/d/y/s/e

How can I rewrite this to copy all in My Documents but avoid the folder 'My Music'
0
Comment
Question by:al4629740
  • 4
  • 2
6 Comments
 
LVL 26

Expert Comment

by:farhankazi
ID: 21799619
You can use /EXCLUDE switch of XCOPY command.
Like:
@ECHO My Music >ExcludeList.txt
xcopy "%userprofile%\My Documents\*.*"   "I:\Backup\" /c/f/h/d/y/s/e /EXCLUDE:ExcludeList.txt

Open in new window

0
 
LVL 26

Expert Comment

by:farhankazi
ID: 21799646
Sorry exclude list file should be in following format:

\My Music\
\My Videos\
\Any other folder\
@ECHO \My Music\>ExcludeList.txt
xcopy "%userprofile%\My Documents\*.*"   "I:\Backup\" /c/f/h/d/y/s/e /EXCLUDE:ExcludeList.txt

Open in new window

0
 

Author Comment

by:al4629740
ID: 21799666
Is this how I would do multiple folders?
@ECHO \My Music\>ExcludeList.txt
@ECHO \My Videos\>ExcludeList.txt
xcopy "%userprofile%\My Documents\*.*"   "I:\Backup\" /c/f/h/d/y/s/e /EXCLUDE:ExcludeList.txt
 

Open in new window

0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 26

Accepted Solution

by:
farhankazi earned 500 total points
ID: 21799679
> (single greater then sign) always creates new file and to append into the file existing file use >> (double greater then sign).
Like:
@ECHO \My Music\>ExcludeList.txt
@ECHO \My Videos\>>ExcludeList.txt
xcopy "%userprofile%\My Documents\*.*"   "I:\Backup\" /c/f/h/d/y/s/e /EXCLUDE:ExcludeList.txt

Open in new window

0
 

Author Comment

by:al4629740
ID: 21799724
So a third would look like this:
@ECHO \My Music\>ExcludeList.txt
@ECHO \My Videos\>>ExcludeList.txt
@ECHO \My Pictures\>>ExcludeList.txt
xcopy "%userprofile%\My Documents\*.*"   "I:\Backup\" /c/f/h/d/y/s/e /EXCLUDE:ExcludeList.txt
 

Open in new window

0
 
LVL 26

Expert Comment

by:farhankazi
ID: 21799751
Yes, exactly
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question