Recent

Author Topic: Deleting a directory and all subdirectory  (Read 20538 times)

BlueIcaro

  • Hero Member
  • *****
  • Posts: 820
    • Blog personal
Deleting a directory and all subdirectory
« on: September 19, 2010, 01:36:53 am »
Hello, how can I read a folder and the subfolders, to delete the files inside and the folders?

/BlueIcaro

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Deleting a directory and all subdirectory
« Reply #1 on: September 19, 2010, 01:44:24 am »
Code: [Select]
RemoveDir(DirNameString);
Removes an empty Dir.

captian jaster

  • Guest
Re: Deleting a directory and all subdirectory
« Reply #2 on: September 19, 2010, 02:29:24 am »
Code: [Select]
RemoveDir(DirNameString);
Removes an empty Dir.
He wants to know how to delete a folder with content...
@OP
Use FindFirst/FindNext/FindClose to delete files in the folder then the folder...
You can probably find a far better way to do this.....

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Re: Deleting a directory and all subdirectory
« Reply #3 on: September 19, 2010, 07:43:10 am »
Code: [Select]
      Result:=DeleteDirectory(NomeDir,True);
      if Result then begin
        Result:=RemoveDirUTF8(NomeDir);
      end;

DeleteDirectory delete the content. A t the end, if all is ok, RemoveDirUTF8 delete the folder.

Hi, Mario

BlueIcaro

  • Hero Member
  • *****
  • Posts: 820
    • Blog personal
Re: Deleting a directory and all subdirectory
« Reply #4 on: September 19, 2010, 09:31:31 am »
Thank you bonmario for the example, it's works nice.

Also Thank you Captain Jasper for your anwser too.

/BlueIcaro

 

TinyPortal © 2005-2018