Copy folders

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Ed Diarrhea
Posts: 6
Joined: 01 Jul 2011 16:38

Copy folders

#1 Post by Ed Diarrhea » 01 Jul 2011 16:45

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?

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: Copy folders

#2 Post by nitt » 01 Jul 2011 16:52

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.

Ed Diarrhea
Posts: 6
Joined: 01 Jul 2011 16:38

Re: Copy folders

#3 Post by Ed Diarrhea » 01 Jul 2011 17:08

Hi thank you can give example please. I know not xcopy. sorry english is bad for me

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: Copy folders

#4 Post by nitt » 01 Jul 2011 17:17

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.

Post Reply