DeleteDirectory() 공개 메소드

Deletes remote directory specified by path.
is null or contains only whitespace characters. Client is not connected. was not found on the remote host. Permission to delete the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public DeleteDirectory ( string path ) : void
path string Directory to be deleted path.
리턴 void
예제 #1
0
파일: SftpClient.cs 프로젝트: zyfzgt/FTPbox
        public override async Task Remove(string cpath, bool isFolder = false)
        {
            var caughtException = default(Exception);
            await Task.Run(() =>
            {
                try
                {
                    if (isFolder)
                    {
                        _sftpc.DeleteDirectory(cpath);
                    }
                    else
                    {
                        _sftpc.Delete(cpath);
                    }
                }
                catch (Exception ex)
                {
                    ex.LogException();
                    caughtException = ex;
                }
            });

            if (caughtException != default(Exception))
            {
                throw caughtException;
            }
        }
예제 #2
0
        public static void DeleteRemoteDirectory(string host, string directory, string username, string password)
        {
            using (var sftp = new SftpClient(host, username, password))
            {
                sftp.Connect();

                sftp.DeleteDirectory(directory);

                sftp.Disconnect();

            }
        }