Ok this works. But there is a lot of uneccessary stuff within my profile that I don't want to take up valuable backup space. How do I specify not to backup certain data (ie Application Data)?
Main Topics
Browse All TopicsWe have been enjoying the wonders of robocopy for the past several years on xp machines. Everything worked great! Now, that we added a couple of vista machines we are experiencing some issues.
This was the original script that works fine with xp boxes:
robocopy "C:\Documents and Settings\%username%\My Documents" "\\Hines\backups\%username
robocopy "C:\Documents and Settings\%username%\favori
robocopy "C:\Documents and Settings\%username%\Deskto
With the addition of Vista machines I added this line:
robocopy "C:\Users\%username%\Docum
The weird thing is that the vista machine will copy over the Desktop folder and the Favorites folder (both of which work even though I am not specifying their true vista locations) while nothing shows up under users/%username%\documents
What am I doing wrong? Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
In princple, you can exclude folders by adding
/xd "Exclude this folder"
to the options.
But it actually should have backed up only the folders under %UserProfile% that are listed in the SourceCommon and SourceByOS variables, so Application Data shouldn't have been copied.
Can you post the robocopy header of a command? (and for testing, you can use the /L switch, which will simulate a run, but not actually copy anything).
When tried using the script listed above the only thing that copied over was the Desktop and Favorites folder but no Documents.
When I tried running something like this:
robocopy "%UserProfile" "\\Hines\backups\%username
This copied everything in the profile including non-essential files
This is the script that I ran
@echo off
setlocal
set RCOptions=/A /S /V /NP /R:2 /W:5
set SourceCommon="Favorites" "Desktop"
ver | find "Windows XP" && set SourceByOS="My Documents"
ver | find "Vista" && set SourceByOS="Documents"
for %%a in (%SourceCommon%) do (
robocopy "%UserProfile%\%%~a" "\\Hines\backups\%username
)
for %%a in (%SourceByOS%) do (
robocopy "%UserProfile%\%%~a" "\\Hines\backups\%username
This only copied the Favorites and Desktop folders
Finally had access to a Vista machine; the script only copied Favorites and Desktop because Vista's "ver" output doesn't contain "Vista" (it's actually "Microsoft Windows [Version 6.0.6001]"), so the script couldn't set the OS specific source folder. Replacing "Vista" with "6.0" will do the trick.
When posting the script, I've explicitly mentioned that you'd need to verify this output, so in all fairness, I think that http:#25584876 provided a correct answer.
http:#25584876 should provide a correct answer, if line 6 is replaced with
ver | find "6.0" && set SourceByOS="Documents"
Business Accounts
Answer for Membership
by: oBdAPosted on 2009-10-15 at 14:02:00ID: 25584876
Do not, ever, use "C:\Documents and Settings\%username%"; this is NOT necessarily the correct path.
To access a user's profile, always use %UserProfile%; this works from NT4 to W2k8.
You can verify the "real" folder names that robocopy will see with a "dir" in a command shell.
Note that you can use a script like this to create different source folder lists depending on the OS, and run them accordingly (verify the Vista output of "ver", can't check it at the moment):
Select allOpen in new window