TanBandradi Posted February 1, 2007 Share Posted February 1, 2007 Dear AutoIt Forum, How to detect if a file is in use? the file is not only limited to .exe file extension, but also .tmp and etc. I need this to delete temporary files in @TempDir folder, but the deletion process takes longer if the deletion attempts to the file that in use. Thank you in advance, Tan Link to comment Share on other sites More sharing options...
Shevilie Posted February 1, 2007 Share Posted February 1, 2007 Well the best i can come up with is to do this Func DelIFNotInUse($filename) $file = FileOpen($filename, 2) If $file <> -1 Then FileClose($file) FileDelete($filename) EndIf EndFunc Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
TanBandradi Posted February 1, 2007 Author Share Posted February 1, 2007 Yes, this is the best solution, thanks! Tan Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now