MakeDir (create a directory)

function MakeDir(directory: string): boolean

The MakeDir function creates a directory. It also creates, if needed, the entire directory tree.

Suppose, for example, that a “docs” directory exists in the root of the remote file server, and you MakeDir('/docs/personal/spreadsheets'), the MakeDir function will proceed to create the “personal” directory inside the “docs” directory, and then the “spreadsheets” directory inside the “personal” directory, all with a single function call.

This method returns true if the directory is successfully created on the remote side, otherwise it returns false.

Example:

{
  var cli = new SftpClient();
  cli.Host = 'your.sftpserver.com:22';
  cli.User = 'someusername';
  cli.KeyFile = './my_id.rsa';
  if (cli.Connect()) {
    // ...
    cli.MakeDir('/docs/personal/spreadsheets');
    // ...
    cli.Close();
  }
  cli = null
}