@@ -63,16 +63,19 @@ public void Upload(DirectoryInfo directoryInfo, string path)
6363 channel . DataReceived += ( sender , e ) => input . Write ( e . Data , 0 , e . Data . Length ) ;
6464 channel . Open ( ) ;
6565
66- // Send channel command request
66+ // start recursive upload
6767 channel . SendExecRequest ( string . Format ( "scp -rt \" {0}\" " , path ) ) ;
6868 CheckReturnCode ( input ) ;
6969
70+ // set last write and last access time on specified remote path
7071 InternalSetTimestamp ( channel , input , directoryInfo . LastWriteTimeUtc , directoryInfo . LastAccessTimeUtc ) ;
71- SendData ( channel , string . Format ( "D0755 0 {0}\n " , Path . GetFileName ( path ) ) ) ;
72+ SendData ( channel , string . Format ( "D0755 0 {0}\n " , "." ) ) ;
7273 CheckReturnCode ( input ) ;
7374
75+ // recursively upload files and directories in specified remote path
7476 InternalUpload ( channel , input , directoryInfo ) ;
7577
78+ // terminate upload of specified remote path
7679 SendData ( channel , "E\n " ) ;
7780 CheckReturnCode ( input ) ;
7881 }
@@ -156,7 +159,7 @@ private void InternalUpload(IChannelSession channel, Stream input, DirectoryInfo
156159 var directories = directoryInfo . GetDirectories ( ) ;
157160 foreach ( var directory in directories )
158161 {
159- InternalSetTimestamp ( channel , input , directoryInfo . LastWriteTimeUtc , directoryInfo . LastAccessTimeUtc ) ;
162+ InternalSetTimestamp ( channel , input , directoryInfo . LastWriteTimeUtc , directory . LastAccessTimeUtc ) ;
160163 SendData ( channel , string . Format ( "D0755 0 {0}\n " , directory . Name ) ) ;
161164 CheckReturnCode ( input ) ;
162165
0 commit comments