Computing.Net > Forums > Programming > BATCH HELP: Copy entire directory

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.

BATCH HELP: Copy entire directory

Reply to Message Icon

Name: saquinn
Date: August 31, 2005 at 02:28:21 Pacific
OS: Windows XP Professional
CPU/Ram: Intel 3.06 GHz, 1024 MB R
Comment:

Hello,

Would it be possible to write a batch file which copies the contents of entire directory to another location? I don't want the script to copy the directory itself, merely the contents, to another folder which the script will prompt for.

I need the script to prompt for:

(a) the contents of which directory to copy,
(b) the location to which the contents will be copied.

The script needs to check whether (b) exists. If it doesn't, it needs to create (b) before copying. If (b) exists, it just needs to append the copied files.

Example:

Copy contents of what directory?
[User enters X]
Copy contents of [X] to where?
[User enters Y]
:If [Y] doesn't exist, it is created and files are copied to [Y]. If [Y] exists, files are appended to [Y].

Appreciated,

Simon.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: August 31, 2005 at 03:46:16 Pacific
Reply:

@echo off
echo source directory ?
set /p source=
echo destination directory ?
set /p dest=
xcopy %source% %dest%\

M2
If at first you don't succeed, you're about average.


0
Reply to Message Icon

Related Posts

See More


java looks grey Pausing execution-Batch o...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: BATCH HELP: Copy entire directory

help on creating DOS Batch file www.computing.net/answers/programming/help-on-creating-dos-batch-file/15163.html

batch folder copying www.computing.net/answers/programming/batch-folder-copying/16133.html

Batch file copy and Rename www.computing.net/answers/programming/batch-file-copy-and-rename/18689.html