How can I Create folders recursively in Delphi?

后端 未结 2 1618
误落风尘
误落风尘 2021-02-12 12:41

Need some help in creating function which can create folders recursively with giving path:

C:\\TestFolder\\Another\\AndAnother

Delphi function

2条回答
  •  自闭症患者
    2021-02-12 13:25

    This uses the new IOUtils instead of SysUtils.
    IOUtils is cross-platform compatible and UNC aware (but is also buggy in a few places).

    function ForceDirectories(FullPath: string): Boolean;   // Works with UNC paths
    begin
      TDirectory.CreateDirectory(FullPath);
      Result:= DirectoryExists(FullPath);
    end;
    

提交回复
热议问题