Page 1 of 1

Copy folders

Posted: 01 Jul 2011 16:45
by Ed Diarrhea
Hi this is my first post obviously. I am trying to copy all the folders and sub folders from one location to another. I am having no luck. I am very new to batch. Can someone please help me?

Re: Copy folders

Posted: 01 Jul 2011 16:52
by nitt
Ed Diarrhea wrote:Hi this is my first post obviously. I am trying to copy all the folders and sub folders from one location to another. I am having no luck. I am very new to batch. Can someone please help me?


For copying folders and subfolders you need to use XCOPY, not COPY.

Re: Copy folders

Posted: 01 Jul 2011 17:08
by Ed Diarrhea
Hi thank you can give example please. I know not xcopy. sorry english is bad for me

Re: Copy folders

Posted: 01 Jul 2011 17:17
by nitt
Ed Diarrhea wrote:Hi thank you can give example please. I know not xcopy. sorry english is bad for me


Code: Select all

mkdir newfolder
xcopy /e folder1 newfolder


The "/e" will make sure to copy all files and directories even if they are empty. I don't think this automatically creates a new directory, so that's why I used "mkdir" to create a new directory to copy the contents of the other one in.

So basically, this copies folder1 to newfolder.