Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: uploading and showing in the console success vs failure

$
0
0
try this
            using (var file = File.OpenRead(localFileName))
            {
                               Console.WriteLine("\rUploading --> " + remoteFileName);
                               Console.WriteLine("started at " + DateTime.Now+ "");
                               var asynch = sftp.BeginUploadFile(file1, remoteDirectoryInvoiceFileName);
                               var sftpAsynch = asynch as SftpUploadAsyncResult;

                                while (!sftpAsynch.IsCompleted)
                                {
                                    
                                    Console.Write(String.Format("\rUploaded {0} of {1}.", sftpAsynch.UploadedBytes, file.Length));

                                }
                                sftp.EndUploadFile(asynch);
                                Console.WriteLine("Ended at " + (DateTime.Now ) + "");
                
            }

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>