Link to home
Start Free TrialLog in
Avatar of lesa
lesa

asked on

Verifying whether the file is opened before deleting

I have a situation in which I am deleting a file using Kill(Path), but before deleting the file I need to check whether the file is opened by user through another application so that I can prompt the user that the file is in use before deleting. How can I achieve it.

Briefly how can I check whether the file is opened by some other application. File may be of any extension like .xls, .doc, .txt.
ASKER CERTIFIED SOLUTION
Avatar of waty
waty
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lesa
lesa

ASKER

Sorry for the delayed response. I don't want to open the file, I just want to delete the file and before that I need to verify if the file is being used by some other application so that I an propmt the user to close the file before deleting.
This is the only solution. To know if the file is open, you need to access it. There is nowhere a property set telling that the file is currently openend.