SSH.NET icon indicating copy to clipboard operation
SSH.NET copied to clipboard

Renci.SshNet.Common.SftpPathNotFoundException: No such file (in existing files)

Open insinfo opened this issue 3 years ago • 7 comments

I'm getting a lot of SftpPathNotFoundException errors, and the files exist because I can copy them via Powershell SCP and Filezilla

image

image

log

failed: /var/www/html/teste/marcos/poo/projeto1_antigo_com_tudo/cadCli - C?pia1.php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec(ZipFile zip, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 90
failed: /var/www/html/teste/marcos/poo/projeto1_antigo_com_tudo/cadCli - C?pia2.php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec(ZipFile zip, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 90
failed: /var/www/html/teste/marcos/C?pia de P_entrada1.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec(ZipFile zip, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 90
failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS Seg Fase.pdf | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec(ZipFile zip, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 90
failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS - 2? fase.doc | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec(ZipFile zip, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 90
failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS.doc | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec(ZipFile zip, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 90
failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS.pdf | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec(ZipFile zip, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 90
...
Download File failed: /var/www/html/teste/marcos/poo/projeto1_antigo_com_tudo/cadCli - C?pia1.php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/teste/marcos/poo/projeto1_antigo_com_tudo/cadCli - C?pia2.php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/teste/marcos/C?pia de P_entrada1.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS Seg Fase.pdf | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS - 2? fase.doc | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS.doc | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/teste/aline/SCS/Relat?rio de Testes SCS.pdf | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download Directory failed: /var/www/html/teste/RAFAEL_PROJOVEM/teste/Introdu??o_php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Sftp.SftpSession.RequestOpenDir(String path, Boolean nullOnError)
   at Renci.SshNet.SftpClient.InternalListDirectory(String path, Action`1 listCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 120
Download File failed: /var/www/html/DESENVnovosimco/imagens/C?pia de fundo_popup.jpg | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/pop2019_antigo/WEB_op__C?pia 2.php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/Manual_do_SIME_para_Maca?.pdf | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/DESENV_SCS/imagens/images/C?pia de print.gif | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in 
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/ABDALLA 12?.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at Co
....Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/JO?O EJA.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/INAY? 410.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/INAY? 408.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/PROF? MARINETE 4? ano.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/PROF? MARINETE 7? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/M? Teixeira 903.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/MARIA TEIXEIRA 6? Ano.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/VER. PEDRO 7? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/Inay? 505.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/MARIA PENHA 14?.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/TRINDADE 5? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/FRANCISCO 8? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/MARIA PENHA 4? ano.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/SIMAR 4? ano.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/MARIA TEIXEIRA 7? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/INAY? 8? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/VER. PEDRO 8? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/saero/public_html_SAERO VELHO/teste/conteudo/xtra/FRANCISCO 9? ANO.csv | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
...
Download File failed: /var/www/html/pop2019/includes/C?_³pia de aux_qualify2.dbm | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download File failed: /var/www/html/pop2019/WEB_op__C?pia 2.php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
Download Directory failed: /var/www/html/DESENVg2Ds/Pasta sem t?tulo | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Sftp.SftpSession.RequestOpenDir(String path, Boolean nullOnError)
   at Renci.SshNet.SftpClient.InternalListDirectory(String path, Action`1 listCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 120
Download File failed: /var/www/html/recall/online/C?pia de recadserv_pdf.php | Error:Renci.SshNet.Common.SftpPathNotFoundException: No such file
   at Renci.SshNet.Common.AsyncResult.EndInvoke()
   at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
   at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
   at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)
   at Renci.SshNet.SftpClient.DownloadFile(String path, Stream output, Action`1 downloadCallback)
   at ConsoleApp1.Program.DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, String sourceRemotePath) in C:\MyCsharpProjects\fsbackup\Program.cs:line 141
end Download
Execution Time: 5864845 ms

O C:\MyCsharpProjects\fsbackup\bin\x64\Debug\net6.0\fsbackup.exe (processo 18832) foi encerrado com o código 0.
Para fechar o console automaticamente quando a depuração parar, habilite Ferramentas -> Opções -> Depuração -> Fechar o console automaticamente quando a depuração parar.
Pressione qualquer tecla para fechar esta janela...

static void Main(string[] args)
        {
            var watch = new System.Diagnostics.Stopwatch();
            watch.Start();

            var connectionInfo = new ConnectionInfo("192.168.2.77", "root",
                                        new PasswordAuthenticationMethod("root", "pass"));
            var client = new SftpClient(connectionInfo);            
            client.Connect();

            DownloadDirectoryAsZip2(client, "/var/www/html", @"C:\MyCsharpProjects\fsbackup\download.zip");
            client.Dispose();  

            Console.WriteLine("end Download");
            watch.Stop();
            Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms");
        }
public static void DownloadDirectoryAsZip2(SftpClient sftpClient, string sourceRemotePath, string destLocalPath)
        {
            using (var zipFile = new FileStream(destLocalPath, FileMode.OpenOrCreate))
            {
                using (var archive = new ZipArchive(zipFile, ZipArchiveMode.Update))
                {
                    DownloadDirectoryAsZipRec2(archive, sftpClient, sourceRemotePath);                    
                }
            }                
        }
        private static void DownloadDirectoryAsZipRec2(ZipArchive archive, SftpClient sftpClient, string sourceRemotePath)
        {
            try
            {
                var files = sftpClient.ListDirectory(sourceRemotePath);
                foreach (var file in files)
                {
                    if ((file.Name != ".") && (file.Name != ".."))
                    {
                        var sourceFilePath = sourceRemotePath + "/" + file.Name;
                      
                        if (file.IsDirectory)
                        {
                            DownloadDirectoryAsZipRec2(archive, sftpClient, sourceFilePath);
                        }
                        else
                        {

                            //var memoryStream = new MemoryStream();
                            // var memoryStream = File.Create(Path.GetTempFileName(), 4096, FileOptions.DeleteOnClose);
                            ZipArchiveEntry entry = archive.CreateEntry(sourceFilePath);
                            using (Stream memoryStream = entry.Open()) { 

                                try
                                {
                                    sftpClient.DownloadFile(sourceFilePath, memoryStream);
                                }
                                catch (Exception e)
                                {
                                    Console.WriteLine($"Download File failed: {sourceFilePath} | Error:{e}");
                                }
                                
                            }
                        }
                    }
                }
            }catch (Exception e)
            {
                Console.WriteLine($"Download Directory failed: {sourceRemotePath} | Error:{e}");
            }
        }

insinfo avatar Apr 08 '22 18:04 insinfo