Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I would like a script that would copy a folder \\Server-1\homes$\bob
to \\Server-2\backUp$\bobOr to copy every thing in H Drive to Y Drive.
If possible when copying \\Server-1\homes$\bob Or H drive, it will creat a new folder which names is made of the current date (and time if poss) on \\Server-2\backUp$\bob or Y drive to make Y:\Data\, and copy the files in this new folder.
I have been looking on the internet and can't find anything that works, If anyknows a script that can do this, please put it here.
(The second part the dated folder is not so important)
Thanks.

"can't find anything that works"
EH?
So you put in batch file commands into google?
"I would like a script that would copy a folder \\Server-1\homes$\bob
to \\Server-2\backUp$\bob"xcopy \\Server-1\homes$\bob\*.* \\Server-2\backUp$\bob /s /o /v
"Or to copy every thing in H Drive to Y Drive."
H:
cd\
xcopy *.* Y: /s /o /vAssuming the account you are running under already has these drive mappings. Otherwise you have you map the drives first in the script before running xcopy.
Consider using ntbackup to copy your files. It has better compression though you have to use it to restore files vs just having them available on server b.
run xcopy /? at a cmd prompt to learn more about xcopy.

I am English so example is for English date format.
At CMD prompt
md Yourfilename__%date:~-10,2%.%date:~-7,2%.%date:~-4,4%
This will give 18.10.2008
To change to American swap 10,2 and 7,2

Thanks that works but is there a way i can put that in a .bat file so i dont have to type it in each time.
Thanks

Are you talking to me? Sorry wanderer if I am butting in. Sorry Chris if you were talking to wanderer.
That said...
Try this@echo off
cls
set /p drive= Enter folder path:-
set drive=%drive%
pushd %drive%set /p name= Enter folder name:-
set name=%name%
md %name%_%date:~-10,2%.%date:~-7,2%.%date:~-4,4%
exitObviously make the necessary changes to date format

![]() |
![]() |
![]() |

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