Sign in to follow this  
Followers 0
sambuddy

Unable to delete some files

5 posts in this topic

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



Have you tried using FileClose on the text files to ensure that they are closed.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

#3 ·  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

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  
Followers 0