Solved

RoboCopy: Clarification of /xo Switch

Posted on 2012-03-28
5
19,790 Views
1 Endorsement
Last Modified: 2012-03-28
Thanks in advance for your assistance.

My question is this:
The robocopy switch /xo has been described this way by Microsoft, "Excludes older files"
http://technet.microsoft.com/en-us/library/cc733145(v=ws.10).aspx#BKMK_remarks

Another source has this to say "eXclude Older - if destination file exists and is the same date or newer than the source - don't bother to overwrite it."
http://ss64.com/nt/robocopy.html

Both of these resources fail to define "older" and "date" respectively, in other words, is it modified date or created date that /xo checks against?

Thanks a lot for your help!

PS. Forgive the section selection, I could not locate any categories concerning batch or scripting.
1
Comment
Question by:yladmin
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Bartender_1
Comment Utility
/XO : eXclude Older - if destination file exists and is the same date
                     or newer than the source - don't bother to overwrite it.

What this means, is if the file exists in both locations, and this switch is included in the command, it will compare the file in the destination, with the file in the source, to see which is newer.

You can see more about robocopy switches here:

http://ss64.com/nt/robocopy.html

Hope this helps!

:o)

Bartender_1
0
 
LVL 22

Assisted Solution

by:Bartender_1
Bartender_1 earned 250 total points
Comment Utility
Sorry, I forgot to say that the "date" will rely on timestamps, which by default will be the date modified, not the creation date.
0
 
LVL 1

Author Comment

by:yladmin
Comment Utility
You definitely answered my question in the 2nd post, thank you. I was wondering if I could verify this information, specifically, "by default [this] will be the date modified". It's a rather lot of mission-critical data I am interacting with so if there is one (I couldn't find it) I would love to find a source, if it's not too much trouble.
0
 
LVL 82

Accepted Solution

by:
oBdA earned 250 total points
Comment Utility
Yes, it uses the "modified" date.
You can verify this by running a robocopy command with "/L" (to not do anything except logging) and "/TS". "/TS" will list the time stamps that robocopy uses, and if you compare them with what Explorer or "dir" tells you, they're about the same as the Modified date.
I say "about the same" because the hours (but not minutes and seconds!) will differ (in all likelihood) between robocopy's output and Explorer's output. That's because NTFS stores all file times in UTC, and robocopy does not translate the time stamp into local time, so the hours will be off according to the time zone your machine is in.
File Times
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724290(v=vs.85).aspx

And I'm afraid I have to correct both Bartender_1 and the "other source" slightly: robocopy always compares time stamps (and sizes) if a file exists both in source and in target, and it will by default copy if they differ in any way. If the time "is the same date ..." (and size), you don't need to use /XO to tell robocopy to not copy the file, robocopy wouldn't copy it anyway.
/XO will prevent the copy if the source file is older than the target file (accordingly, /XN will prevent the copy if it the source is newer than the target file).
2
 
LVL 1

Author Closing Comment

by:yladmin
Comment Utility
This is wonderfully helpful, I am thankful for the help from both of you.
oBdA: Your clarification, sourcing, and test was exactly what I needed to proceed confidently.
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

As a long-time IT Professional, the most important skill I have developed and consider to be my most valuable tool is Effective Troubleshooting. Step through my problem-solving procedure in this 10-step guide adapted from The Universal Troubleshooti…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

744 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

18 Experts available now in Live!

Get 1:1 Help Now