Copy a folder and its content to another drive

How do you copy a folder and all its content from one drive e.g. C:\backup to another drive e.g. Q:\backup with a batch file to run every night at 12 o'clock.
jodyreidIT ManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
You can use XCOPY, ROBOCOPY or just plain COPY.

<copy command> "C:\BACKUP\*.*" "Q:\BACKUP"

Then schedule the copy with the Task Scheduler in control panel (Scheduled Tasks)
Lee W, MVPTechnology and Business Process AdvisorCommented:
If you provide more information on your requirements, we may be able to help further.
jodyreidIT ManagerAuthor Commented:
I have a back running everynight on one server from one program. This is a program that backup to the Q drive in a folder called \\mayo\harvbak. I need to batch file copy this folder to another server and in to another folder everynight to \\westmeath\Backup. This is over the network. Is this posible.
Thank you.
Jody
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Harisha M GEngineerCommented:
Hi jodyreid, elaborating leew's suggestion,

create a batch file as follows with a name, say mycopy.bat :

XCOPY /S /Y /C /Q /H C:\backup\* Q:\backup

Then goto Start --> Programs --> Accessories --> System Tools --> Sheduled Tasks
Add New task, browse your file, then select every day and set the time as 12:00 AM


---
Harish
Harisha M GEngineerCommented:
Harisha M GEngineerCommented:
jodyreid,

at \\computername 00:00 /every:M,T,W,Th,F,S,Su "XCOPY /S /Y /C /Q /H C:\backup\* Q:\backup"
cwwkieCommented:
mgh_mgharish, the at command will probably not work, because the system user will have no access to the network drive.

Scheduled Tasks would be fine, because you can enter the user under which the command is executed. But instead of specifying drive Q: it is better to use the unc path (like \\westmeath\Backup)
jimmymcp02Commented:
ok so lets try the following


first of all you need to map the drive

so lets creat the batch file
this will disconnect any current drives to prevent from copying the file to the wron location

net use g: /d

rem begin drive mapping

net use g: \\192.168.1.250\c$ password /user:Administrator /persistent:no

rem copying file

copy C:\backup\* g:\backup

net use g: /d

then schedule it through task manager and use your criteria
VIMALCHANDCommented:


1. Map the Backfolder as a drive say [K:]
2. xcopy k:\*.* c:\backupofserver /e

Regards

Subramanian
jimmymcp02Commented:
st of all you need to map the drive

so lets creat the batch file
sorry there was an error on the script it was supposed to be C:\backup\*.* not c:\backup\*

net use g: /d

rem begin drive mapping

net use g: \\192.168.1.250\c$ password /user:Administrator /persistent:no

rem copying file

copy C:\backup\*.* g:\backup

net use g: /d

then schedule it through task manager and use your criteria

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.