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

Just starting out? Need help? Post your questions and find answers here.
webbmeister
User
User
Posts: 62
Joined: Thu Mar 16, 2006 5:20 pm
Location: Sheffield, UK

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

Post 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
Fred
Administrator
Administrator
Posts: 16618
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Are you using an explorertreegadget() or an explorerlistgadget() ?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

@Fred: Isn't DeleteDirectory a standalone command?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
webbmeister
User
User
Posts: 62
Joined: Thu Mar 16, 2006 5:20 pm
Location: Sheffield, UK

Post by webbmeister »

It's compiled as a console app by the way - no windows

Im not using exploregadget...
Fred
Administrator
Administrator
Posts: 16618
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It's strange, it should delete the folder. Do you do any examinedirectory() or other directory operations before that ?
webbmeister
User
User
Posts: 62
Joined: Thu Mar 16, 2006 5:20 pm
Location: Sheffield, UK

Post 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?
Fred
Administrator
Administrator
Posts: 16618
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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 ?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

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

Post 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?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
webbmeister
User
User
Posts: 62
Joined: Thu Mar 16, 2006 5:20 pm
Location: Sheffield, UK

Post 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.
User avatar
oryaaaaa
Enthusiast
Enthusiast
Posts: 791
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post by oryaaaaa »

THANKS!!!!  :D

Please add this trouble to helpfile.
Simo_na
Enthusiast
Enthusiast
Posts: 177
Joined: Sun Mar 03, 2013 9:01 am

Re:

Post by Simo_na »

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

Please add this trouble to helpfile.
Quote...
Post Reply