Solved

RoboCopy: Clarification of /xo Switch

Posted on 2012-03-28
5
24,793 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: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 250 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 84

Accepted Solution

by:
oBdA earned 250 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
There's a better way to communicate time sensitive or critical info.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

792 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