Link to home
Start Free TrialLog in
Avatar of Jody Reid
Jody ReidFlag for United States of America

asked on

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.
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

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)
If you provide more information on your requirements, we may be able to help further.
Avatar of Jody Reid

ASKER

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
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
jodyreid,

at \\computername 00:00 /every:M,T,W,Th,F,S,Su "XCOPY /S /Y /C /Q /H C:\backup\* Q:\backup"
Avatar of cwwkie
cwwkie

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)
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


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

Regards

Subramanian
ASKER CERTIFIED SOLUTION
Avatar of jimmymcp02
jimmymcp02
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial