Jump to content

Recommended Posts

Posted

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

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

Posted

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

Posted (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.Posted Image

Edited by Googler24022
Posted

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
Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...