Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Robo copy exclude not working, need help with syntax or whatever the cause is

Posted on 2011-03-11
7
Medium Priority
?
964 Views
Last Modified: 2012-05-11
I have this script I am running and I have a exclude set but it doesn't seem to be working, the share folder is copying fine but the exclude1 and exclude2 are still being copied instead of excluded.

Is there a problem with the syntax or something else? This is for migrating data to a network storage device from a Windows 2003 file and print server. I ran this on another machine and had the same problem.
set Source=\\server\share\

 

set Destination=\\networkstorage\share\

 

set LogFile="C:\CopyLogs\Copy_log.log"

Set Exclude=\\server\share\exclude1\
Set Exclude=\\server\share\exclude2\

robocopy.exe %Source% %Destination% /ZB /MIR /COPYALL /XD %Exclude% /R:5 /W:1 /LOG:%LogFile% /TEE

Open in new window

0
Comment
Question by:REIUSA
  • 5
7 Comments
 

Author Comment

by:REIUSA
ID: 35109015
Also, I have tried the same command above with only one excluded folder and had the same problem. I think I actually left out the extra exclude form the command but either way it didn't work with one exclude either.
0
 
LVL 6

Accepted Solution

by:
LHT_ST earned 750 total points
ID: 35109105
the way you have it set up at the moment, you are changing the variable exclude. its sets to the exclude1 path and then you set it to the exclude2 path so even if it did work it would only exclude the exclude 2 path.

i take it you dont have any spaces in th exclude paths either?
0
 

Author Comment

by:REIUSA
ID: 35109531
I see, if I set to variables for exclude do I need to use the /XD command twice or just once with both %exclude% %exclude2% behind it?

I still don't get why it doesn't work with the XD command even with only one exclude variable.
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
LVL 10

Assisted Solution

by:Casey Herman
Casey Herman earned 750 total points
ID: 35109791
change this Set Exclude=\\server\share\exclude1\
to this Set Exclude=\\server\share\exclude1\*.*

and see what happens.
0
 

Author Comment

by:REIUSA
ID: 35280450
It's weird, I ran a test on my local PC and on a Netapp share and it worked fine. Is there any reason that much larger amounts of data being copied would cause it not to exclude properly?
0
 

Author Comment

by:REIUSA
ID: 35421599
After fooling around with it a little more I changed it so the exclusion path used the drive letter instead of just the UNC, I have no idea why this would work but it seems like it did.

Changed to something like this....
Set Exclude=\\server\E$\share\exclude1\
0
 

Author Closing Comment

by:REIUSA
ID: 35421601
After fooling around with it a little more I changed it so the exclusion path used the drive letter instead of just the UNC, I have no idea why this would work but it seems like it did.

Changed to something like this....
Set Exclude=\\server\E$\share\exclude1\
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

783 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