Working with the Directory System
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.
Creating and Deleting Directories
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 ...
Get Delphi for .NET Developer’s Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.