Introduction
This is the first in a series of articles describing how to get started with using the JADE Client via its Command Line Interface and configuring simple file management tasks.
The articles in this series are:
- Getting Started and Downloading files
- Simple File Selection
- More Advanced File Selection
- Checking files for completeness
- Public / Private Key Authentication
For setting-up and running the examples see Using the tutorials with the JADE Client Command Line Interface
Simple JADE file transfer operations - download by FTP and SFTP
Transferring the contents of a folder by FTP
In this example the contents of a folder on a remote host are downloaded from our demonstration FTP server and saved on your local file system.
Example
The following profile from your settings file will be used to run the example on your computer:
[ftp_server_2_local] ;; operation = copy ;; source_host = test.sos-berlin.com source_protocol = ftp source_port = 21 source_user = demo source_password = demo source_dir = / ;; target_host = localhost target_protocol = local target_dir = ${USERPROFILE}\jade_demo\a
The parameters listed above should not require further description and are the minimum that are required to copy files from the demo user's root directory on the remote source to a local target directory. By default JADE will download all the files it finds in the directory.
Run the example by entering the following in the command line:
jade.cmd -settings="%USERPROFILE%\jade_demo\jade_settings.ini" -profile="ftp_server_2_local"
Behavior
JADE will log onto the remote server and download all the files it finds in the source_dir folder before stopping.
Note that by default JADE will create the target folder and/or path if it does not exist and if JADE has the necessary permissions. It will also overwrite any files it finds in the target directory with the same names as files it is downloading.
Note also that the transfer mode JADE uses for FTP transfer can be specified using the transfer_mode parameter (not used in the example). This can be either ascii or binary (the default setting).
Transferring the contents of a folder by SFTP with password authentication
This example uses the second profile in our examples settings file, sftp_server_2_local_pass, which is quite similar to the ftp_server_2_local profile used in the previous example.
As the new profile name suggests, the SFTP protocol is used in this profile and authentication is by user/password. Key pair authentication is described later in this series of articles.
Example
The profile is included in the jade_settings_windows.ini file as follows:
[sftp_server_2_local_pass] ;; operation = copy ;; source_host = test.sos-berlin.com source_protocol = sftp source_ssh_auth_method = password source_port = 22 source_user = demo source_password = demo source_dir = / ;; target_host = localhost target_protocol = local target_dir = ${USERPROFILE}\jade_demo\a
Then call this profile by entering the following in the Windows command line:
jade.cmd -settings="%USERPROFILE%\jade_demo\jade_settings.ini" -profile="sftp_server_2_local_pass"
Behavior
As with the FTP transfer profile, JADE will log onto the remote server and download all the files in the source_dir folder before stopping.