Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use robocopy to tranfer a single file from one location to another but robocopy seems to think I'm always specifying a folder. Here is an example:

robocopy "c:\transfer_this.txt" "z:\transferred.txt"

But I get this error instead:

2009/08/11 15:21:57 ERROR 123 (0x0000007B) Accessing Source Directory c:\transfer_this.txt\

(note the '\' at the end of transfer_this.txt)

But if I treat it like an entire folder:

robocopy "c:\folder" "z:\folder"

It works but then I have to transfer everything in the folder.

How can I only transfer a single file with robocopy?

share|improve this question
up vote 75 down vote accepted

See: Robocopy /?

Usage : ROBOCOPY source destination [file [file]...] [options]

robocopy c:\folder d:\folder transfer_this.txt
share|improve this answer
fwiw, at least on win2003: Quoting directory paths seems to make it hiccup. – samsmith Sep 15 '13 at 19:52
@samsmith I've seen it hiccup when you have a \ before the closing quote (i.e.: ROBOCOPY "c:\folder1\" c:\folder2 file won't work but: ROBOCOPY "c:\folder1" c:\folder2 file does. I expect it's a text escaping thing – Mike Goatly Oct 23 '15 at 7:22
@MikeGoatly Excellent point. Robocopy does NOT like trailing \. It wants you to name the directories as "names" and does not want to imply in any way that it accepts anything other than a directory. – samsmith Oct 23 '15 at 16:26

According to the Wikipedia article on Robocopy:

Folder copier, not file copier

Robocopy syntax is markedly different from standard copy commands, as it accepts only folder names as its source and destination arguments. File names and wild-card characters (such as ".*") *are not valid source or destination arguments. Files may be selected or excluded using the optional filespec filtering argument. Filespecs can only refer to the filenames relative to the folders already selected for copying. Fully-qualified path names are not supported. For example, in order to copy the file foo.txt from directory c:\bar to c:\baz, one could use the following syntax**

robocopy c:\bar c:\baz foo.txt

share|improve this answer

Try inserting a space before the destination, like this:

robocopy "c:\transfer_this.txt" "z: \this.txt" 

notice the space after the destination "folder" z:.

share|improve this answer
This did not work for me, I had to follow @KPWINC's instructions and leave the file name out of the source path. – influent Nov 25 '15 at 0:17
This is a troll answer? Tried and does not work (nor does it seem like it would have worked). – Pacerier May 4 at 4:24

robocopy Q:\ F:\Dopbox "Microsoft" /MT:128

share|improve this answer
Robocopy source destination filename – Dale Jun 4 at 10:34
A command without explanation is not a useful answer. – kasperd Jun 4 at 12:31

protected by Sven Jun 4 at 11:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?