Skip to content

File Management

Robinicks edited this page Feb 3, 2020 · 9 revisions

API

Working directory (relative paths are relative to this directory):

  • GetWorkingDirectory() - Gets the full path of the current working directory.

  • SetWorkingDirectory() - Sets the full path of the current working directory. All relative paths are relative to the working directory.

Directories:

  • DirectoryExists() - Check if a directory exists on the server.

  • CreateDirectory() - Creates a directory on the server. If the parent directories do not exist they are also created.

  • DeleteDirectory() - Deletes the specified directory on the server. If it is not empty then all subdirectories and files are recursively deleted.

  • MoveDirectory() - Moves a directory from one place to another on the server. The destination directory is deleted before moving if FtpExists.Overwrite is used. Only throws exceptions for critical errors.

Files:

  • FileExists() - Check if a file exists on the server.

  • DeleteFile() - Deletes the specified file on the server.

  • MoveFile() - Moves a file from one directory to another on the server. The destination file is deleted before moving if FtpExists.Overwrite is used. Only throws exceptions for critical errors.

  • Rename() - Renames the file/directory on the server. Low level method that should NOT be used in most cases. Prefer MoveFile() and MoveDirectory(). Throws exceptions if the source does not exist, or if the destination already exists.

  • GetModifiedTime() - Gets the last modified date/time of the file or folder. Result may be in server timezone, local timezone or UTC, depending on type argument.

  • SetModifiedTime() - Modifies the last modified date/time of the file or folder. Input may be in server timezone, local timezone or UTC, depending on type argument.

  • GetFileSize() - Gets the size of the file in bytes, or -1 if not found.

  • DereferenceLink() - Recursively dereferences a symbolic link and returns the full path if found. The MaximumDereferenceCount property controls how deep we recurse before giving up.