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

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Folder Copy Script

Reply to Message Icon

Original Message
Name: Chris (by Chris Kirk)
Date: October 18, 2008 at 08:04:54 Pacific
Subject: Folder Copy Script
OS: XP
CPU/Ram: _
Manufacturer/Model: _
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.


Report Offensive Message For Removal


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.



Report Offensive Follow Up For Removal

Response Number 2
Name: 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


Report Offensive Follow Up For Removal

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


Report Offensive Follow Up For Removal

Response Number 4
Name: 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


Report Offensive Follow Up For Removal

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

Thanks that works fine.


Report Offensive Follow Up For Removal







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



Results for: Folder Copy Script

Make a batch file to copy data
    Summary: You can use f.i. vbscript. Then the variable NOW gives the current date and time. With some string manipulation you can generate the new folder. Copying data is then not difficult with this script lan...
www.computing.net/answers/windows-xp/make-a-batch-file-to-copy-data-/103565.html

Web Folders Copy Error
    Summary: The problem is that when we use web folders and try to copy to it, we get an error messages saying ‘An error occurred copying some or all of the files selected’. The problem only seems to happen ...
www.computing.net/answers/windows-xp/web-folders-copy-error/126398.html

Outlook rule help needed
    Summary: Has anyone created an Outlook script that performs an SNMP trap? Questions: Are pieces of the email(ie: Subject, Body) available to be used by a script? All help is appreciated. ...
www.computing.net/answers/windows-xp/outlook-rule-help-needed-/152963.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History






Data Recovery Software