@@ -44,14 +44,14 @@ public synchronized int copy(LocalSourceFile sourceFile, String remotePath)
4444 }
4545
4646 public synchronized int copy (LocalSourceFile sourceFile , String remotePath , ScpCommandLine .EscapeMode escapeMode ) throws IOException {
47- return copy (sourceFile , remotePath , escapeMode , true );
47+ return copy (sourceFile , remotePath , escapeMode , true , true );
4848 }
4949
50- public synchronized int copy (LocalSourceFile sourceFile , String remotePath , ScpCommandLine .EscapeMode escapeMode , boolean preserveTimes )
51- throws IOException {
50+ public synchronized int copy (LocalSourceFile sourceFile , String remotePath , ScpCommandLine .EscapeMode escapeMode , boolean preserveTimes , boolean defaultArgs )
51+ throws IOException {
5252 engine .cleanSlate ();
5353 try {
54- startCopy (sourceFile , remotePath , escapeMode , preserveTimes );
54+ startCopy (sourceFile , remotePath , escapeMode , preserveTimes , defaultArgs );
5555 } finally {
5656 engine .exit ();
5757 }
@@ -62,11 +62,9 @@ public void setUploadFilter(LocalFileFilter uploadFilter) {
6262 this .uploadFilter = uploadFilter ;
6363 }
6464
65- private void startCopy (LocalSourceFile sourceFile , String targetPath , ScpCommandLine .EscapeMode escapeMode , boolean preserveTimes )
66- throws IOException {
67- ScpCommandLine commandLine = ScpCommandLine .with (ScpCommandLine .Arg .SINK )
68- .and (ScpCommandLine .Arg .RECURSIVE )
69- .and (ScpCommandLine .Arg .LIMIT , String .valueOf (bandwidthLimit ), (bandwidthLimit > 0 ));
65+ private void startCopy (LocalSourceFile sourceFile , String targetPath , ScpCommandLine .EscapeMode escapeMode , boolean preserveTimes , boolean defaultArgs )
66+ throws IOException {
67+ ScpCommandLine commandLine = initialScpArguments (defaultArgs );
7068 if (preserveTimes ) {
7169 commandLine .and (ScpCommandLine .Arg .PRESERVE_TIMES , sourceFile .providesAtimeMtime ());
7270 }
@@ -76,6 +74,13 @@ private void startCopy(LocalSourceFile sourceFile, String targetPath, ScpCommand
7674 process (engine .getTransferListener (), sourceFile , preserveTimes );
7775 }
7876
77+ protected ScpCommandLine initialScpArguments (boolean defaultArgs ) {
78+ if (!defaultArgs ) return ScpCommandLine .with (ScpCommandLine .Arg .SINK );
79+ return ScpCommandLine .with (ScpCommandLine .Arg .SINK )
80+ .and (ScpCommandLine .Arg .RECURSIVE )
81+ .and (ScpCommandLine .Arg .LIMIT , String .valueOf (bandwidthLimit ), (bandwidthLimit > 0 ));
82+ }
83+
7984 private void process (TransferListener listener , LocalSourceFile f , boolean preserveTimes )
8085 throws IOException {
8186 if (f .isDirectory ()) {
0 commit comments