Delete directory recursive

Jan 18, 2013 at 12:43 PM
Edited Jan 18, 2013 at 6:57 PM

Hi again, is there a method to recursively delete a directory or should i implement it ?

Edit:  no big deal this should work ok:

Edit:  this is for the SftpClient class --

 

        /// <summary>
        /// Deletes the directory recursively.
        /// </summary>
        /// <param name="remoteDirectory">The remote directory.</param>
        protected void DeleteDirectoryRecursive(string remoteDirectory)
        {
            if (!Client.Exists(remoteDirectory))
                return;

            foreach (var file in Client.ListDirectory(remoteDirectory))
            {
                if (file.Name.Equals(".") || file.Name.Equals(".."))
                    continue;

                if (file.IsDirectory)
                    DeleteDirectoryRecursive(file.FullName);
                else
                    Client.DeleteFile(file.FullName);
            }

            Client.DeleteDirectory(remoteDirectory);
        }

 

 

Thanks

Coordinator
Jan 18, 2013 at 1:25 PM

 

Hi,

 

Sorry, No I currently don't have any recursive operations :(:(

 

Thanks,

Oleg