324Views6Replies

Author Options:

Copy a specific directory in batch? Answered

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?

Tags:batch

Discussions

0
None
AndyGadget

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

0
None
XOIIOAndyGadget

Answer 7 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

0
None
AndyGadgetXOIIO

Answer 7 years ago

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

0
None
XOIIOAndyGadget

Answer 7 years ago

Yeah, I found ot while browsing the help menu. it is a great program.

0
None
NachoMahmaNachoMahma

Answer 7 years ago

. That should be /S /E together will copy all sub-dirs. /E by itself won't do it.