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

BATCH HELP: Copy entire directory

Reply to Message Icon

Original Message
Name: saquinn
Date: August 31, 2005 at 02:28:21 Pacific
Subject: BATCH HELP: Copy entire directory
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.


Report Offensive Message For Removal

Response Number 1
Name: Mechanix2Go
Date: August 31, 2005 at 03:46:16 Pacific
Subject: BATCH HELP: Copy entire directory
Reply: (edit)

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


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: BATCH HELP: Copy entire directory

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software