• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 42406
  • Last Modified:

RoboCopy: Clarification of /xo Switch

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
yladmin
Asked:
yladmin
  • 2
  • 2
2 Solutions
 
Christopher McKayMicrosoft Network AdministratorCommented:
/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
 
Christopher McKayMicrosoft Network AdministratorCommented:
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
 
yladminAuthor Commented:
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
 
oBdACommented:
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
 
yladminAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now