copy file

T

tom mcd

I would like to write a vb6 exe file to copy a csv file
from c:\times to F:\times on a daily basis. Anyone be able
to help me. Thanks all.
 
R

Ron Weiner

Tom

This is pretty simple stuff, but why would you go to this trouble to
something is already built into the OS. If it were me I'd create a batch
file that copied your file from hither to yon and use the Windows scheduler
to fire it off on whatever schedule was appropriate.

In VB create a new project, add a form, add a timer to the form.
Set the timer to fire once a minute
in OnTimer event of this form you would code

Static dteLastRun as Date
If Time() >= #09:00# And Date() > dteLastRun Then
' Run the fileCopy at 9:00am or a few seconds after 9:00am every day
dteLastRun = Date()
FileCopy "c:\times\Hither", "f:\times\Yon"
End If

Make this an Exe, and run it.

The big dissadvantages to the VB solution is that your app must always be
running as an active application, and in order to change the schedule you
have to modify the applications source code and make a new exe. Both of
these problems can be easily overcome with more programming, but why waste
the time to write, debug, and test code that the OS can already handle?

Ron W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top