Solved

Backup script avoid My Music

Posted on 2008-06-16
6
181 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
Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

 
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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

687 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