Solved

Backup script avoid My Music

Posted on 2008-06-16
6
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Command prompt output to variable? 9 86
Robycopy Copy Data \ Disk to Disk (new\changed data) 19 157
Autorun Remote Desktop - USB Stick 6 84
Odd Coloration 4 43
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

737 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