none
Robocopy - Wildcard to copy everything from current source directory

    Question

  • I'd like to use Robocopy (I'm using Xcopy now) to copy everything from the 'current' folder. It appears that Robocopy absolutely has to have a path of some sort to correctly work. In Xcopy, we were able to run

    Xcopy *.* C:\somedirectory\

    If I try the same in Robocopy I get a an error

    "No Destination Directory Specified"
    Orange County District Attorney
    Friday, February 5, 2010 4:54 PM

Answers

  • Hi Sandy,

    It's true ROBOCOPY doesn't handle wild cards, but what you're after is still possible:

    Say I want this:

    C:\temp> robocopy *.* c:\temp2\

    I'll get the error you get - "No Destination Directory Specified"

    BUT, if you try this:

    C:\temp>  robocopy c:\temp\ c:\temp2\

    ROBOCOPY will work and do what your after. Quotation marks can also be used in the above path references.

    I suppose one of the reasons for the lack of wildcard support is the fact that ROBOCOPY actually works to exclude files types later with the /XF switch (such as "/XF *.mp3"). More here.

    Hope this helps,

    Friday, February 5, 2010 8:07 PM

All replies

  • Hi Sandy,

    It's true ROBOCOPY doesn't handle wild cards, but what you're after is still possible:

    Say I want this:

    C:\temp> robocopy *.* c:\temp2\

    I'll get the error you get - "No Destination Directory Specified"

    BUT, if you try this:

    C:\temp>  robocopy c:\temp\ c:\temp2\

    ROBOCOPY will work and do what your after. Quotation marks can also be used in the above path references.

    I suppose one of the reasons for the lack of wildcard support is the fact that ROBOCOPY actually works to exclude files types later with the /XF switch (such as "/XF *.mp3"). More here.

    Hope this helps,

    Friday, February 5, 2010 8:07 PM
  • Thanks Kevin, I think that will work. Too bad the wild cards are not usable.
    Orange County District Attorney
    Friday, February 5, 2010 9:05 PM
  • You're welcome.. I hope you get what your after... you may also want to take a look at HoboCopy - that does a similar thing, seems to support wildcards and uses the Volume Shadow Copy service to copy open files..

    Thanks,
    Friday, February 5, 2010 9:14 PM
  • Wow, I've never heard of HoboCopy. It looks pretty good - for me, I normally don't need all the switches in a product like Robocopy; and I like the VSS integration that Hobocopy has.

    My use now is limited to copying application files for installation on a Windows 7 image. We use the Microsoft Deployment Toolkit to create our images and install the apps we need. Some of our apps are very old and we install them by copying them to the local machine (during image creation) and then running come vbscripts to craeat shortcuts for them. We're try ing to standardize on Robocopy instead of xcopy.


    Orange County District Attorney
    Friday, February 5, 2010 9:36 PM
  • Sandy,

    That's all good.. for what you describe robocopy would have no problem handling that task. There are a number of great uses for robocopy and hobocopy in terms of backup.. one type of use (for example) is when used backup a user's documents folder:

    robocopy "%USERPROFILE%\Documents" "H:\localfiles\Documents" /E /PURGE /V /NP /XF *.mp3 *.m4a *.pst *.tmp *.avi *.wav /R:10 /W:30

    or with hobocopy backing up data (in an accounting directory) to an external drive:

    HoboCopy /statefile=z:\backup\accounting\directcopy\hbstate /incremental /skipdenied /y /r d:\accounting\ z:\backup\accounting\directcopy\ > z:\backup\accounting\DirectLog.log

    Thanks,
    Friday, February 5, 2010 11:00 PM
  • I'm curious, what is the advantage of RoboCopy over Xcopy?

    Rich
    Saturday, February 6, 2010 1:44 AM
  • Hello from 2014, Sandy.
    You can use "." to specify that you want to copy from/to the current directory.
    For example,
      //this copies all files from the current directory to C:\some\other\path
      robocopy . C:\some\other\path
      //and the other way around
      robocopy C:\some\other\path .
    You can also use ".." to specify that you want to copy from/to the parent directory.
    For example,
      //this copies all files from the current directory to the parent directory
      robocopy . ..
      //this copies all files from the directory which is two levels up to the parent directory
      robocopy ..\.. ..
    You can use this with xcopy as well.
    Note that "." and ".." are not specific to robocopy or xcopy, see en.wikipedia.org/wiki/Path_(computing)
    Hope that helps.
    Tuesday, July 29, 2014 9:40 AM
  • One reason why I had to switch from using xcopy to robocopy was that xcopy doesnt work for long folder path.

    It gives an error "Insufficient Memory" when the total characters exceed a certain limit. Robocopy doesnt have that limitation.

    Also, in many other ways its definately an upgrade.. ;)

    Saturday, August 8, 2015 7:24 AM
  • The wildcard you want is the often-overlooked single 'dot' which means 'current directory'.   We normally only use the two dots to indicate 'parent directory'.   Thus: 

    robocopy . c:\somedirectory  *.*      

    It's actually kinda hard to see it, but it makes all the difference to robocopy.  

    Thursday, September 29, 2016 8:18 PM