Solved

robocopy syntax

Posted on 2014-01-22
7
464 Views
Last Modified: 2014-01-24
Can someone help me write a robocopy statement that will copy any file named *f.jpg on the C:\ drive to the E:\ drive, not overwriting anything.
0
Comment
Question by:hrolsons
  • 3
  • 3
7 Comments
 
LVL 11

Expert Comment

by:epichero22
Comment Utility
robocopy *f.jpg c:\ e:\ /E

*Edit: Do you know if the files in the destination are newer or older?
0
 

Author Comment

by:hrolsons
Comment Utility
The files in the destination should be newer.
0
 

Author Comment

by:hrolsons
Comment Utility
I was reading here:

http://stackoverflow.com/questions/4228807/copy-files-w-o-overwrite

That I need to do 3 more switches.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 51

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
Comment Utility
robocopy c:\ e:\ *f.jpg /s /xc /xn /xo

The /s gets all non-empty subfolders (if you want empty ones, make that /e) and the /xc /xn /xo is a cutesy way not to overwrite. I've attached the full syntax of Robocopy so you can see why those three options result in no overwriting. Regards, Joe
robocopy-help.txt
0
 

Author Comment

by:hrolsons
Comment Utility
So I'm still unclear if:

robocopy c:\ e:\ *f.jpg /e

is the same as:

robocopy c:\ e:\ *f.jpg /e /xc /xn /xo

Or is it just redundant?
0
 
LVL 51

Assisted Solution

by:Joe Winograd, EE MVE
Joe Winograd, EE MVE earned 500 total points
Comment Utility
No, it's not the same. The  /xc /xn /xo switches are effectively what implements no-overwrite. Without them, it will overwrite. Here's what those options mean:

/XC eXclude Changed files.

/XN eXclude Newer files.

/XO eXclude Older files.

So if you exclude changed, newer, and older files, it won't overwrite anything. It will copy only files that aren't already there, which I believe is what you asked for. Regards, Joe
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Actually, you could do just /xc. In other words, detecting a changed file means, by definition, that the same file exists in both the source and destination folders...otherwise, it wouldn't be changed! Run some experiments on small sets of files to see what happens.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

743 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

13 Experts available now in Live!

Get 1:1 Help Now