Jump to content
Sign in to follow this  
sambuddy

Unable to delete some files

Recommended Posts

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

;******************************************************************************

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 :P

BR

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...