@@ -63,16 +63,19 @@ public void Upload(DirectoryInfo directoryInfo, string path)
63
63
channel . DataReceived += ( sender , e ) => input . Write ( e . Data , 0 , e . Data . Length ) ;
64
64
channel . Open ( ) ;
65
65
66
- // Send channel command request
66
+ // start recursive upload
67
67
channel . SendExecRequest ( string . Format ( "scp -rt \" {0}\" " , path ) ) ;
68
68
CheckReturnCode ( input ) ;
69
69
70
+ // set last write and last access time on specified remote path
70
71
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 " , "." ) ) ;
72
73
CheckReturnCode ( input ) ;
73
74
75
+ // recursively upload files and directories in specified remote path
74
76
InternalUpload ( channel , input , directoryInfo ) ;
75
77
78
+ // terminate upload of specified remote path
76
79
SendData ( channel , "E\n " ) ;
77
80
CheckReturnCode ( input ) ;
78
81
}
@@ -156,7 +159,7 @@ private void InternalUpload(IChannelSession channel, Stream input, DirectoryInfo
156
159
var directories = directoryInfo . GetDirectories ( ) ;
157
160
foreach ( var directory in directories )
158
161
{
159
- InternalSetTimestamp ( channel , input , directoryInfo . LastWriteTimeUtc , directoryInfo . LastAccessTimeUtc ) ;
162
+ InternalSetTimestamp ( channel , input , directoryInfo . LastWriteTimeUtc , directory . LastAccessTimeUtc ) ;
160
163
SendData ( channel , string . Format ( "D0755 0 {0}\n " , directory . Name ) ) ;
161
164
CheckReturnCode ( input ) ;
162
165
0 commit comments