473,387 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Kill Files! Pause code until files deleted?

Hi

I've written the following code:

ConfirmDel = MsgBox("Do you want to delete all files from the memory stick?", vbYesNo)

If ConfirmDel = vbYes Then
Kill FromPath & "*.*"
MsgBox "All files have been deleted. You may now remove the memory stick."
Else
MsgBox "You may now remove the memory stick."
End If

The messages obviously pop up before the files have been deleted which isn't good. Is there anyway of redoing this so the messages wait?

Thanks - Chris
Jul 13 '07 #1
3 1441
Mague
137 100+
I have searched the net and cannot find anything. It should be easy but isnt.

Hope you find the answer.

Also are you using vb or vb.net?
Jul 13 '07 #2
danp129
323 Expert 256MB
In vb6 I'd try:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. kill frompath & "."
  3. while dir(frompath & ".") <> ""
  4.     doevents
  5. wend
  6. ...

I didn't really test it though so not sure if '.' and '..' directories (current and parent folders respectively) will show up and cause a problem with the example. You may also get stuck in a loop if there is some type of permission issue keeping you from deleting the file so you need to test for that.
Jul 14 '07 #3
Thanks for the help. The code is doing it's job but I've also decided to ask users to wait for light on the stick to stop flashing!

BTW - I'm doing this in MS Access.
Jul 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Alex Hunsley | last post by:
I'm running a monitoring script under linux written in python. It's nohup'ed so that I can log out and it will continue running happily and so on, but sometimes I need to kill the script before...
1
by: Isidro Vila Verde | last post by:
Greetings, I need to handle signals to close some excel applications that my script open, when the script is killed by another process. My script is a little bit complex, but I wrote just two ...
10
by: Vilmar Brazão de Oliveira | last post by:
HI people, what is wrong in the code bellow to kill iexplore.exe process after processing my page?? '»»Before comes routines to access data base and to send email. Set objWshell =...
10
by: Jako Menkveld | last post by:
I'm building a relatively simple client-server app. One of the functions of the client is to notify the server when it terminates, this all works fine. The problem comes in when the server is...
2
by: Micky | last post by:
Can any one give me some pointers on how to kill a running procedure in DB2? I have a long running procedure called from a Java routine and after I kill the Java routine, the procedure keeps...
3
by: pattanawadee | last post by:
Deall All, Could anybody suggestion me How to kill all inherrit processes (sibling child,previous and parent process) in the case I know only child process id and user id, For example I strart...
1
by: Alexander N. Spitzer | last post by:
I am trying to write a program that will fork a process, and execute the given task... the catch is that if it runs too long, I want to clean it up. this seemed pretty straight forward with a...
6
by: Matthew Wieder | last post by:
What permissions must a user have to be able to succesffuly execute a Process.Kill? I can run it with Admin privleges but not with regular user priveleges - I get an "Access is Denied." The...
1
by: Manfred Braun | last post by:
Hi All, I am writing a tool, which should monitor some exe-processes, which are not very solid. Th main function is to re-start them, if they hung, but this is complicated. I can detect things...
3
by: spectrumdt | last post by:
Hello. I am running Fedora Linux and KDE, using the Konsole command line. When coding Python, I regularly make a bug causing my program to not terminate. But how do I kill the non-terminating...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.