How to Create Multiple Directories

Posted December 15th @ 9:20 pm by m3Rlin

The standard MkDir() function can create only one directory, it can not create subdirectories at one time. This function allows you to create multiple directories (directories inside directories). Delphi 4+ have the ForceDirectories() routine which does the same thing. It is declared in the FileCtrl unit.

uses
SysUtils, FileCtrl;

procedure MkDirMulti(sPath: string);
begin
if sPath[Length(sPath)] = [...]

How to Get the Windows System Directory

Posted December 15th @ 6:56 pm by m3Rlin

To found out the name of the Windows directory it’s best to use the Windows API GetSystemDirectory() function.
Here’s the Delphi implementation:

uses Windows;

function GetSystemDir: string;
const
(* The length of the directory buffer. Usually 64 or even 16 is enough
**
** Must be DWORD type.
*)
dwLength: DWORD = 255;
var
psSysDir: PChar;
begin
GetMem(psSysDir, dwLength);
GetSystemDirectory(psSysDir, [...]

« Previous Entries