Solved

Backup script avoid My Music

Posted on 2008-06-16
6
167 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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now