Page 1 of 1

DeleteDirectory() command does not remove the folder...

Posted: Thu Apr 13, 2006 12:06 pm
by webbmeister
DeleteDirectory() command does not remove the folder...

I have tried

Code: Select all

 DeleteDirectory(dir.s,"",#PB_FileSystem_Recursive)
This deletes the contents, but does not remove the actual folder. Any Ideas on this one?

I'm using PB4 B7

Posted: Thu Apr 13, 2006 12:17 pm
by Fred
Are you using an explorertreegadget() or an explorerlistgadget() ?

Posted: Thu Apr 13, 2006 12:22 pm
by PB
@Fred: Isn't DeleteDirectory a standalone command?

Posted: Thu Apr 13, 2006 12:23 pm
by webbmeister
It's compiled as a console app by the way - no windows

Im not using exploregadget...

Posted: Thu Apr 13, 2006 12:31 pm
by Fred
It's strange, it should delete the folder. Do you do any examinedirectory() or other directory operations before that ?

Posted: Thu Apr 13, 2006 12:34 pm
by webbmeister
Fred wrote:It's strange, it should delete the folder. Do you do any examinedirectory() or other directory operations before that ?

Code: Select all

If failedcopy=0
  PrintN("Done!")
  PrintN("")
  PrintN("Delete Source Dir? (Y/N)")
  r.s=Input()

  If LCase(r.s)="y"
    DeleteDirectory(dir.s,"",#PB_FileSystem_Recursive)
  EndIf
I don't use examine directory. Should I be?

Posted: Thu Apr 13, 2006 1:16 pm
by Fred
No, you don't have to use ExamineDirectory(), but if you used it and didn't called FinishDirectory(), it could have locked it. BTW, can you delete this dir with the explorer ?

Re: DeleteDirectory() command does not remove the folder...

Posted: Thu Apr 13, 2006 1:25 pm
by PB
@webbmeister: This works fine for me -- what about you?

Code: Select all

MakeSureDirectoryPathExists_("c:\xxx\yyy\zzz\")
DeleteDirectory("c:\xxx\","",#PB_FileSystem_Recursive)
Can you post a snippet that shows it failing? And what does dir.s hold?

Posted: Thu Apr 13, 2006 11:19 pm
by webbmeister
Fred was right! It was my own silly fault. :oops: I had used a ExamineDirectory(ID,Dir.s,"") command earlier in the code on on the dir.s path.
But not used a FinishDirectory(ID) command to follow! Therefore the directory was still locked.

Still, thanks for all the suggestions.

Posted: Sun Jul 02, 2006 6:42 pm
by oryaaaaa
THANKS!!!!  :D

Please add this trouble to helpfile.

Re:

Posted: Sat Jul 02, 2022 3:49 pm
by Simo_na
oryaaaaa wrote: Sun Jul 02, 2006 6:42 pm THANKS!!!!  :D

Please add this trouble to helpfile.
Quote...