Discuss this help topic in SecureBlackbox Forum

SFTP: Delete a file or directory

To delete the file, use RemoveFile() or RemoveFiles() methods of TElSimpleSFTPClient class. RemoveFile() accepts the absolute path to the file (SFTP doesn't have a concept of "current directory") as a parameter. RemoveFiles() method of TElSimpleSFTPClient class lets you remove files by mask or by given list of names.

These methods are synchronous and return when the operation is completed.

To delete the directory, use RemoveDirectory() method. The method accepts the absolute path to the directory (SFTP doesn't have a concept of "current directory") as a parameter. The advanced version of RemoveDirectory() method lets you remove the files and subdirectories of the given directory (thus clearing the directory before removal).

The method is synchronous and returns when the data is sent.

For information about error handling, see the corresponding how-to article.

How To articles about SFTP client

Discuss this help topic in SecureBlackbox Forum