sambuddy Posted December 11, 2006 Share Posted December 11, 2006 Hello, I've written a script that will create some text files. At the end of the script, I go through and delete all the files left in the directory. All but the text files get deleted. Here is the code I am using to delete them. Does anyone have any suggestions? Thanks ;****************************************************************************** Func FINISH() ExitFileDelete($current_directory & "\WOWVisibleOfferIcon.mux") FileDelete($current_directory & "\vpes.exe") FileDelete($current_directory & "\pes2tp.exe") FileDelete($current_directory & "\otvsi.psi") FileDelete($current_directory & "\mpeg2mux.exe") FileDelete($current_directory & "\internal.m2v") FileDelete($current_directory & "\internal.m2a") FileDelete($current_directory & "\audiopkt.exe") FileDelete($current_directory & "\AV.mux") FileDelete($current_directory & "\app.mux") FileDelete($current_directory & "\hinfo.exe") FileDelete($current_directory & "\vpes_out.txt") FileDelete($current_directory & "\hinfo.txt") FileDelete($current_directory & "\audiopkt_out.txt") FileDelete($current_directory & "\mpeg2mux_av_out.txt") FileDelete($current_directory & "\pes2tp_audio_out.txt") FileDelete($current_directory & "\pes2tp_video_out.txt") FileDelete($current_directory & "\mpeg2mux_stream_out.txt") FileDelete($current_directory & "\AV.vps") FileDelete($current_directory & "\AV.vtp") FileDelete($current_directory & "\AV.aps") FileDelete($current_directory & "\AV.atp") EndFunc ;****************************************************************************** Link to comment Share on other sites More sharing options...
BigDod Posted December 11, 2006 Share Posted December 11, 2006 Have you tried using FileClose on the text files to ensure that they are closed. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Googler24022 Posted December 11, 2006 Share Posted December 11, 2006 (edited) It would be easier to delete all the files first then create your text files afterwards unless it's really necessery for you to delete them after. Edited January 29, 2012 by Googler24022 Link to comment Share on other sites More sharing options...
loginCZ Posted December 12, 2006 Share Posted December 12, 2006 Try to change attributes of files. I prefer following way of file-delete $error = FileSetAttrib( $file_name, "-RSH") If $error <> 1 Then MsgBox(4096,"Attributes","Setting of attributes is not working" & @CRLF & $error) Exit EndIf $error = FileDelete( $file_name) If $error <> 1 Then MsgBox(4096,"Deleting","Deleting error" & @CRLF & $error) Exit EndIf Link to comment Share on other sites More sharing options...
sambuddy Posted December 13, 2006 Author Share Posted December 13, 2006 Hello everyone, Thanks for your input and help. I have found the problem and a silly one it was. I was trying to close the file using it's name and not it's handle BR 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