Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Know if the delete process is finished 1

Status
Not open for further replies.

ajikoe

Programmer
Apr 16, 2004
71
ID
Hello

I would like to know when my deleting process finished.For example:

public static void Main(){
myDeleteMethod();
//NextMove...
}

public static void myDeleteMethod(){
//delete something
}

Question:
How can I assure that when it goes to the NextMove the deleting process are already finished (for example it is very big file).

Sincerely Yours,
Pujo
 
It depends on how your code is written, and when the garbage collector runs. So you'd have to start a loop, waiting for the file to disappear.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
A solution could be to use FileSystemWatcher class to monitor the file you are deleting.
See the WaitForChanged() - a synchronous method that that contains specific information on the change that occurred.
On a FileSystemWatcher object call WaitForChanged(WatcherChangeTypes.Deleted) and also use OnDeleted event.
-obislavu-
 
obislavu is correct. What was I thinking???

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top