robocopy syntax

Posted on 2014-01-22
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.
Question by:hrolsons
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
  • 3
  • 3
LVL 11

Expert Comment

ID: 39801718
robocopy *f.jpg c:\ e:\ /E

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

Author Comment

ID: 39801747
The files in the destination should be newer.

Author Comment

ID: 39801758
I was reading here:

That I need to do 3 more switches.
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

LVL 54

Accepted Solution

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

Author Comment

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?
LVL 54

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
LVL 54

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.

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Suggested Solutions

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
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…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

738 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