RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
FileCtrl.ForceDirectories Function

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

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

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.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!