Computing.Net > Forums > Disk Operating System > Copying folders

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Copying folders

Reply to Message Icon

Name: David Berman
Date: April 12, 2004 at 08:05:27 Pacific
OS: Windows XP
CPU/Ram: Pentium 4; 512 meg ram
Comment:

Is there any way to copy a folder and its contents from one from one directory to another? Xcopy c:\myfile1 f:\myfile2 will only copy the contents of myfile1 to myfile2. I'd like myfile1 to be a subfolder of myfile2 as part of the copy. Is there a way for me to do that?

Thanks..



Sponsored Link
Ads by Google

Response Number 1
Name: novice batcher
Date: April 12, 2004 at 09:47:21 Pacific
Reply:

try a trailing backslash to final destination.

Instead of xcopy C:\myfile1 F:\myfile2
try xcopy C:\myfile1 F:\myfile2\

Everyone wants a faster PC


0

Response Number 2
Name: David Berman
Date: April 12, 2004 at 10:19:45 Pacific
Reply:

Thanks for the response. Unfortunately, doing the xcopy with the trailing backslash still only copies the contents of the source folder.

Dave


0

Response Number 3
Name: hgoree
Date: April 12, 2004 at 12:15:55 Pacific
Reply:

xcopy uses the /s (sub-directories) switch.

type xcopy /? for its use

should be xcopy C:\myfile1 F:\myfile2 /s


0

Response Number 4
Name: David Berman
Date: April 12, 2004 at 14:03:50 Pacific
Reply:

/s does copy the subdirectories to myfile2, but I want to copy the whole myfile1 source folder to myfile2. So in the end, myfile2 would have a subfolder called myfile1 in it.

Dave


0

Response Number 5
Name: Rambler
Date: April 12, 2004 at 14:55:32 Pacific
Reply:

xcopy c:\myfile1 f:\myfile2\myfile1 /e /i

Expert: someone who reads the manual when no-one's looking


0

Related Posts

See More



Response Number 6
Name: David Berman
Date: April 12, 2004 at 17:17:15 Pacific
Reply:

That'll work! Is it possible to write a batch file routine that will compare the files in source (a) and destination (b) directories, add files from a that aren't in b, and overwrite files in b that match files in a, and delete the files in b that aren't in a? Xcopy seems to be able to do all of the above except delete the files in the destination (b) that aren't in the source (a). I guess I could run a delete routine: del f:\myfile2 *.* before running the xcopy routine.

Dave


0

Response Number 7
Name: Rambler
Date: April 13, 2004 at 00:10:48 Pacific
Reply:

Should indeed be possible. The problem you had with XCOPY is that it copies the CONTENTS of a directory (folder - ugh!), so you have to put the directory name in the destination path. That unfortunately results in XCOPY asking whether the destination is a file or folder, which is where the /I switch comes in. I just added the /E for completeness, in case there are any subdirectictories of the source. I assume you know that <command>/? gives help for command parameters?

Expert: someone who reads the manual when no-one's looking


0

Response Number 8
Name: David Berman
Date: April 15, 2004 at 07:07:05 Pacific
Reply:

No I didn't know that. Or, I had forgotten that. I don't use DOS very much anymore.

Dave


0

Response Number 9
Name: Vish
Date: May 9, 2004 at 14:24:40 Pacific
Reply:

how can i get to My Documents if it is in " C:\Documents and Settings\Vish.Home\My Documents " ????

Please Help me.

Help me save My Documents using DOS.


0

Response Number 10
Name: Rambler
Date: May 9, 2004 at 15:51:32 Pacific
Reply:

In a batch file, "%userprofile%\My Documents" (including quotes) references the current user's folder.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Copying folders

Copying Folders via Batch Files www.computing.net/answers/dos/copying-folders-via-batch-files/7493.html

Copying folders www.computing.net/answers/dos/copying-folders/14708.html

How Can I Copy Folders www.computing.net/answers/dos/how-can-i-copy-folders/12823.html