Solved

robocopy syntax

Posted on 2014-01-22
7
473 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
ID: 39801718
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
ID: 39801747
The files in the destination should be newer.
0
 

Author Comment

by:hrolsons
ID: 39801758
I was reading here:

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

That I need to do 3 more switches.
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 52

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 39801760
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
ID: 39801798
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 52

Assisted Solution

by:Joe Winograd, EE MVE
Joe Winograd, EE MVE earned 500 total points
ID: 39801806
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 52

Expert Comment

by:Joe Winograd, EE MVE
ID: 39801817
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Are you looking to recover an email message or a contact you just deleted mistakenly? Or you are searching for a contact that you erased from your MS Outlook ‘Contacts’ folder and now realized that it was important.
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
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…

776 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