Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic delete files

Status
Not open for further replies.

mulderm

Electrical
Jun 4, 2003
35
NL
Hello,

I want a Visual Basic 6.0 program to make the
following handling:

Every week on Sunday morning on 10.00 hour a.m.
the program must delete the files on directory
c:\data.

Who can help me?

Greetings,

mulderm
 
Replies continue below

Recommended for you

Try using the FileSystemObject. It allows you to perform several tasks on your file system.

Put a timer interrupting from minute to minute and checking if it has reached the pretended hour.
Then you just need to delete the file via FileSystemObject.

Don't forget you must keep the program on for it to execute the task.

 
Couple of things to consider. Using the System Timer (an API) you can set the timer for much longer intervals than the built-in Timer control. You may also want to consider using the system Task scheduler to fire off the VB program at the appropriate time.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
You may want to consider using the task manager and a command line batch job.

DEL c:\data\*.*

Simple and no executable programming required.
 
A batch file under Schedules Tasks will be the easiest way under XP

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

UK steam enthusiasts:
 
Thank you guys.

But I am new for this.
Can you give me the code for this?
Thank you.

mulderm
 
BillPSU has given you the text for the batch file. Just save it as a textfile called datadel.bat

Then go to Control Panel|Scheduled Tasks|Add new and follow the Wizard. You will need to supply a user name and password for the task to run

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

UK steam enthusiasts:
 
If you needed a solution for your problem, you've just got it from above.
If you want to learn how to code it, Google will have the answers for you. :p

 
Thank you guys.
I have make the task and it works perfect.

mulderm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top