Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RoboCopy: Clarification of /xo Switch

Posted on 2012-03-28
5
Medium Priority
?
33,941 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
[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
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Christopher McKay
ID: 37778262
/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:Christopher McKay
Christopher McKay earned 1000 total points
ID: 37778270
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
ID: 37778308
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 85

Accepted Solution

by:
oBdA earned 1000 total points
ID: 37778509
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
ID: 37778601
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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Introducing Priority Question, our latest feature.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

609 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