loading

Copy a specific directory in batch?

I am working on a batch file to back up specific folders, the directory is layed out lime this:

Main Folder>saves>world1>etc
                                     world2>etc
                                     world3>etc

Basically, I need a command to copy "world1" or whatever folder it is, but the entire thing, not just the contents. If I copy it to the desktop, it just copies the contents, I want it to directly copy the directory and subdirectories, so that it would show in the target area as "world1". How do I do this with xcopy?


sort by: active | newest | oldest
AndyGadget6 years ago
If you're writing a backup batch, have a look at Microsoft's ROBOCOPY command line utility. I use it for backing up various directories from several PCs. 
XOIIO (author)  AndyGadget6 years ago
Windows 7 has robocopy, but A lot of people have XP, and this batch file is made to be easy to use, so it should be universal, like xcopy
Fairy nuff, if you're making a portable batch.
(I didn't realise they'd included robocopy in Win7.  I got it from a Resource Kit 'long time ago.)
XOIIO (author)  AndyGadget6 years ago
Yeah, I found ot while browsing the help menu. it is a great program.
NachoMahma6 years ago
.  /S will copy non-empty sub-directories. /E will copy all sub-directories. Google is your friend.
. That should be /S /E together will copy all sub-dirs. /E by itself won't do it.