To work with directories, you use the Directory or DirectoryInfo classes. The Directory class provides static methods and is convenient in that you do not have to create an instance of the class to use it. However, each call invokes a security check; therefore, it might be inefficient. In this case, you would use the DirectoryInfo class. These classes provide the methods to manipulate (create, delete, move, copy) directories and to enumerate through the directory hierarchies.
The following code shows how to create a directory using the DirectoryInfo class:
dirInfo := DirectoryInfo.Create('c:\ddgtemp'); if not dirInfo.Exists then dirInfo.&Create;
First, an instance of DirectoryInfo ...