// 한번에 하는 방법은 ForceDirectories 함수를 이용하면 된다..

함수 설명은 아래와 같다..  반환값은 실패 성공 뿐이니까.. 실패 성공만 처리하면된다..
굳이 디렉토리가 존재하는지 확인 할 필요도 없다.
있으면 그냥 넘어가고 없으면 생성하게 된다.

ex) ForceDirectories("C:\\IT\\LOG");

Creates a new directory, including the creation of parent directories as needed.

Pascal
function ForceDirectories(const Dir: string): Boolean;
C++
Boolean ForceDirectories(string Dirconst);

FileCtrl

ForceDirectories creates a new directory as specified in Dir, which must be a fully-qualified path name. If the directories given in the path do not yet exist, ForceDirectories attempts to create them. 

ForceDirectories returns true if it successfully creates all necessary directories, false if it could not create a needed directory.

Warning: 
Important:Do not call ForceDirectories with an empty string. Doing so causes ForceDirectories to raise an exception.  
Note: 
The FileCtrl unit (Windows only) also contains a ForceDirectories function. However, the FileCtrl version is deprecated, and the SysUtils version preferred, even if the code does not need to be cross-platform.  

 


+ Recent posts