I am using a robocopy batch file to backup my work. This is the code in my .bat file:

@echo off
echo press any key to continue backup!
ROBOCOPY "F:\source" "D:\destination" /s /e /xf *.sas7bdat /xd "F:\directory_to_exclude"
echo backup complete

However this does not work and the log output shows that robocopy does not distinguish the destination from the source.

Source: F:\source D:\destination
Dest -
Files *.*
Files excluded: *.sas7bdat
Directories excluded: F:\directory_to_exclude
Error: no folder destination specified

What needs to be changed in the robocopy syntax?


Possible problem is that your source or/and destination ends by \. So you have that sequence of characters \", and robocopy interpret it as escape sequence for literal ". You have to remove \ or double it:

ROBOCOPY "F:\source" "D:\destination"
ROBOCOPY "F:\source\\" "D:\destination\\"
|improve this answer|||||

Your Robocopy output mentions both source and destination paths on the Source: line. Are you sure you quoted the command right?

I copied just the robocopy command and here is my output:

   ROBOCOPY     ::     Robust File Copy for Windows

  Started : Thursday, March 26, 2015 9:48:44 AM
   Source - F:\source\
     Dest - D:\destination\

    Files : *.*

Exc Files : *.sas7bdat

 Exc Dirs : F:\directory_to_exclude

  Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30


When I (double)quote the source and destination wrong I get the following result (like yours):

   Source - F:\source D:\destination\
|improve this answer|||||
  • My bat file uses " as quotation marks. Changing them to 'does not work either and lists the source as F:\ F:\source\'` and destination as F:\ D:\destination\'` and fails because it can't find these directories as they don't exist. – user2568648 Mar 26 '15 at 9:04
  • If your source folder is called source and if your destination folder is actually called destination try to remove the quotation marks since there are no spaces in the foldernames. – Lambert Mar 26 '15 at 9:07
  • Thanks, spaces exist in the real folder names but adding a double slash as PetSerAl mentions solves the problem. – user2568648 Mar 26 '15 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.