Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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.

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

![]() |
java looks grey
|
Pausing execution-Batch o...
|

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