Browse Source

Add tofile attributes to scp.

PR: 26758


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276580 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 21 years ago
parent
commit
268a5447dc
3 changed files with 39 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +14
    -0
      docs/manual/OptionalTasks/scp.html
  3. +22
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java

+ 3
- 0
WHATSNEW View File

@@ -148,6 +148,9 @@ Fixed bugs:
* <scp> now properly handles remote files and directories with spaces
in their names. Bugzilla Report 26097.

* <scp> now has (local|remote)tofile attributes to rename files on the
fly. Bugzilla Report 26758.

Other changes:
--------------
* doc fix concerning the dependencies of the ftp task


+ 14
- 0
docs/manual/OptionalTasks/scp.html View File

@@ -74,6 +74,13 @@ jsch-0.1.14.</p>
exist also in local paths. <em>since Ant 1.6.2</em></td>
<td valian="top" align="center">Alternative to todir attribute.</td>
</tr>
<tr>
<td valign="top">localTofile</td>
<td valign="top">Changes the file name to the given name while
receiving it, only useful if receiving a single file. <em>since
Ant 1.6.2</em></td>
<td valian="top" align="center">Alternative to todir attribute.</td>
</tr>
<tr>
<td valign="top">remoteTodir</td>
<td valign="top">This is an alternative to the todir
@@ -81,6 +88,13 @@ jsch-0.1.14.</p>
<em>since Ant 1.6.2</em></td>
<td valian="top" align="center">Alternative to todir attribute.</td>
</tr>
<tr>
<td valign="top">remoteTofile</td>
<td valign="top">Changes the file name to the given name while
sending it, only useful if sending a single file. <em>since
Ant 1.6.2</em></td>
<td valian="top" align="center">Alternative to todir attribute.</td>
</tr>
<tr>
<td valign="top">port</td>
<td valign="top">The port to connect to on the remote host.</td>


+ 22
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java View File

@@ -115,6 +115,26 @@ public class Scp extends SSHBase {
this.isToRemote = true;
}

/**
* Changes the file name to the given name while receiving it,
* only useful if receiving a single file.
* @since Ant 1.6.2
*/
public void setLocalTofile(String aToUri) {
this.toUri = aToUri;
this.isToRemote = false;
}

/**
* Changes the file name to the given name while sending it,
* only useful if sending a single file.
* @since Ant 1.6.2
*/
public void setRemoteTofile(String aToUri) {
this.toUri = aToUri;
this.isToRemote = true;
}

/**
* Adds a FileSet tranfer to remote host. NOTE: Either
* addFileSet() or setFile() are required. But, not both.
@@ -137,7 +157,8 @@ public class Scp extends SSHBase {

public void execute() throws BuildException {
if (toUri == null) {
throw new BuildException("The 'todir' attribute is required.");
throw new BuildException("Either 'todir' or 'tofile' attribute "
+ "is required.");
}

if (fromUri == null && fileSets == null) {


Loading…
Cancel
Save