Link to home
Start Free TrialLog in
Avatar of patrickm3
patrickm3

asked on

batch file question

I need to have two drives with the exact same files on them.  Is there a way that a simple batch file can be written so that new files on one drive will be copied to another on a daily basis?


patrick
ASKER CERTIFIED SOLUTION
Avatar of twol
twol
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
Avatar of patrickm3
patrickm3

ASKER

I was hoping to write a txt file listing all files to be copied then converting it to a .bat and running it at a set time.  Can you suggest how to do that?

If you are running windows 98, you can schedule the batch file, in the scheduler, of course.


To get a list of files,

go to the root directory you want to start at, then type

dir /b/s > mybatch.bat

this will write the files, including path, to the bat file. Then all you have to
do is edit the batch file to create copy statements.
In addition, on to the original answer I gave you,  the xcopy command has a "D" option that will cause it to only copy the files with a newer timestamp on the source drive to the target drive.