Computing.Net > Forums > Windows XP > Folder Copy Script

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.

Folder Copy Script

Reply to Message Icon

Name: Chris (by Chris Kirk)
Date: October 18, 2008 at 08:04:54 Pacific
OS: XP
CPU/Ram: _
Product: _
Comment:

Hello,
I would like a script that would copy a folder \\Server-1\homes$\bob
to \\Server-2\backUp$\bob

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



Sponsored Link
Ads by Google

Response Number 1
Name: wanderer
Date: October 18, 2008 at 13:08:51 Pacific
Reply:

"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 /v

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



0

Response Number 2
Name: toast (by NoIdea)
Date: October 18, 2008 at 15:33:14 Pacific
Reply:

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


0

Response Number 3
Name: Chris (by Chris Kirk)
Date: October 19, 2008 at 09:56:28 Pacific
Reply:

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


0

Response Number 4
Name: toast (by NoIdea)
Date: October 19, 2008 at 13:56:53 Pacific
Reply:

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%
exit

Obviously make the necessary changes to date format


0

Response Number 5
Name: Chris (by Chris Kirk)
Date: October 27, 2008 at 13:05:20 Pacific
Reply:

Thanks that works fine.


0

Related Posts

See More



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 Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Folder Copy Script

Make a batch file to copy data www.computing.net/answers/windows-xp/make-a-batch-file-to-copy-data-/103565.html

Web Folders Copy Error www.computing.net/answers/windows-xp/web-folders-copy-error/126398.html

Copy Files Problem www.computing.net/answers/windows-xp/copy-files-problem/95698.html