Forum > LCL

Deleting a directory and all subdirectory

(1/1)

BlueIcaro:
Hello, how can I read a folder and the subfolders, to delete the files inside and the folders?

/BlueIcaro

typo:

--- Code: ---RemoveDir(DirNameString);
--- End code ---

Removes an empty Dir.

captian jaster:

--- Quote from: typo on September 19, 2010, 01:44:24 am ---
--- Code: ---RemoveDir(DirNameString);
--- End code ---

Removes an empty Dir.

--- End quote ---
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:

--- Code: ---      Result:=DeleteDirectory(NomeDir,True);
      if Result then begin
        Result:=RemoveDirUTF8(NomeDir);
      end;

--- End code ---

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

Hi, Mario

BlueIcaro:
Thank you bonmario for the example, it's works nice.

Also Thank you Captain Jasper for your anwser too.

/BlueIcaro

Navigation

[0] Message Index

Go to full version