Robocopy - Wildcard to copy everything from current source directory
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"
February 5th, 2010 4:54pm

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, Kevin @calwell on twitter.
Free Windows Admin Tool Kit Click here and download it now
February 5th, 2010 8:07pm

Thanks Kevin, I think that will work. Too bad the wild cards are not usable.
February 5th, 2010 9:05pm

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, Kevin @calwell on twitter
Free Windows Admin Tool Kit Click here and download it now
February 5th, 2010 9:14pm

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.

February 5th, 2010 9:36pm

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, Kevin @calwell on twitter
Free Windows Admin Tool Kit Click here and download it now
February 5th, 2010 11:00pm

I'm curious, what is the advantage of RoboCopy over Xcopy?
February 6th, 2010 1:44am

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.
Free Windows Admin Tool Kit Click here and download it now
July 29th, 2014 9:40am

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.. ;)

August 8th, 2015 3:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics