[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

batch file question

Posted on 2000-01-07
4
Medium Priority
?
186 Views
Last Modified: 2010-04-16
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
0
Comment
Question by:patrickm3
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
twol earned 200 total points
ID: 2333276
Use the xcopy command...


xcopy d:\*.* e:\*.* /s

there are also options to make sure the command will copy
empty subdirectories , etc....


type xcopy /? at your command prompt for a full listing of options.
0
 

Author Comment

by:patrickm3
ID: 2333300
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?

0
 
LVL 7

Expert Comment

by:twol
ID: 2333866
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.
0
 
LVL 7

Expert Comment

by:twol
ID: 2333872
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.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
Simple Linear Regression
Introduction to Processes

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question