Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## examples
Class SCPExample2

    java.lang.Object
      examples.SCPExample2

public class SCPExample2
extends java.lang.Object

Copy a file to/from an SSH1 or SSH2 server using the scp protocol. The scp protocol was introduced with ssh1 and is very similar to the rcp protocol.

See the `main` method for an example on how to do a file transfer, and also how to expand glob expressions.

The `copyFilesWithSSH1` method will copy files using the SSH1 protocol.

The `copyFilesWithSSH2` method will copy files using the SSH2 protocol.

The `doGlob` method will expand glob expressions.

This example requires Java 1.4.

See Also:
  `SSHSCP1`, `SFTPCopyFile`

Constructor Summary
`SCPExample2()`

Method Summary
`static void` | `copyFilesWithSSH1(java.lang.String server, int port, java.lang.String user, java.lang.String privatekeyfile, java.lang.String privatekeypassword, java.lang.String[] files, java.lang.String destination, boolean toremote)` This copies files using an SSH1 connection.
`static void` | `copyFilesWithSSH2(java.lang.String server, int port, java.lang.String user, java.lang.String privatekeyfile, java.lang.String privatekeypassword, java.lang.String[] files, java.lang.String destination, boolean toremote)` This copies files using an SSH2 connection.
`static void` | `main(java.lang.String[] argv)` Run the application

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SCPExample2

    public SCPExample2()

Method Detail

### copyFilesWithSSH1

    public static void copyFilesWithSSH1(java.lang.String server,
                                         int port,
                                         java.lang.String user,
                                         java.lang.String privatekeyfile,
                                         java.lang.String privatekeypassword,
                                         java.lang.String[] files,
                                         java.lang.String destination,
                                         boolean toremote)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException

  This copies files using an SSH1 connection.

  Parameters:
    `server` - server name
    `port` - server port
    `user` - user name
    `privatekeyfile` - the private key file, if null we will try to find the OpenSSH private key file
    `privatekeypassword` - the password for the private key file, null if none needed
    `files` - an array of files that should be transferred
    `destination` - the destination file or directory
    `toremote` - true if files should be copied to the remote server, otherwise false
  Throws:
    `java.io.IOException`
    `java.net.UnknownHostException`

### copyFilesWithSSH2

    public static void copyFilesWithSSH2(java.lang.String server,
                                         int port,
                                         java.lang.String user,
                                         java.lang.String privatekeyfile,
                                         java.lang.String privatekeypassword,
                                         java.lang.String[] files,
                                         java.lang.String destination,
                                         boolean toremote)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException,
                                         SSH2Exception

  This copies files using an SSH2 connection.

  Parameters:
    `server` - server name
    `port` - server port
    `user` - user name
    `privatekeyfile` - the private key file, if null we will try to find the OpenSSH private key file
    `privatekeypassword` - the password for the private key file, null if none needed
    `files` - an array of files that should be transferred
    `destination` - the destination file or directory
    `toremote` - true if files should be copied to the remote server, otherwise false
  Throws:
    `java.io.IOException`
    `java.net.UnknownHostException`
    `SSH2Exception`

### main

    public static void main(java.lang.String[] argv)

  Run the application

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD