Hi all,
In my application, i written a code to delete a folder.
Here is the code: Directory.Delete(folderpath, true);
The problem is that: If some one is opened or using the file in the same folder, It gives me exception.
Is there any possibility to delete a folder even if some one using the files in the folder.
Thanks allot!
Darma
Delete a directory even if someone using the file
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted May 23, 2013, 1:55 AM EDT
However, You should be able to find out who has a file open on a network share using the NET FILE command line utility:
http://technet.microsoft.com/en-us/library/bb490702.aspx
VulpesRank #55 · 29.2K reputationPosted May 23, 2013, 12:59 AM EDT
When a file is open, the operating system places a lock on it so that it can't be deleted.
The operating system will also prevent a folder from being deleted until all files in the folder have been, or can be, deleted which is not therefore possible here.
darma tejaRank #3,199 · 449 reputationPosted May 23, 2013, 1:07 AM EDT
Thanks allot for the reply.
Is there any possibility to know on which computer it is opened or who is opened?
Thanks
Darma