Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Interim save

...

Before starting to transfer files JADE reads the contents of the folder specified using the source_dir one or more child elements of the Selection parameter.

In the examples in first article in this series a default setting, that all the files in the source directory will be downloaded, appliedwas used: .* .

In this article example the source directory file list will be filtered so that only specific files are transferred.

...

  • Filter the names of files to be transferred using a regular expression
  • Transfer files from sub-directories recursively

Example

In the profile listed below, two new parameters have been added to the sftp_server_2_local_pass profile presented in the previous article

Configuration structure

ProtocolFragment

The ftp_demo_sos-berlin ProtocolFragment used in the Client Command Line Interface - Getting Started tutorial will be reused.

Profile

Duplicate the ftp_server_to_local Profile and the name of the new instance changed to ftp_server_to_local_select_recursive.

In the new Profile, the following changes have been made:

  • The value of the file_spec defines the regular expression used to filter file names

  • recursive specifies whether the transfer should be carried out recursively A recursive child element has been added to the FileSpecSelection element and its value set to true (the default value is false).
  • The source_dir parameter has also been changed to:
    • /rec

The relevant file structure on the source server is:

  • /
    • /rec
      test.txt
      test_1.txt
      • /sd
        test_2.txt
Code Block
languagebash
[sftp_server_2_local_select_recursive]
;;
 operation              = copy
 file_spec              = ^test_.\.txt$
;;
 recursive              = true
;;force_files           = false
;;
 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             = /rec
;;
 target_host            = localhost
 target_protocol        = local
 target_dir             = ${USERPROFILE}\jade_demo\a


Image Added

Call this profile by entering the following in the command line:

Code Block
languagebash
titleWindows
jade.cmd -settings="%USERPROFILE%\jade_demo\jade_settings.ini" -profile="sftpftp_server_2_local_select_recursive"

Behavior

The relevant file structure on the source server is:

  • /
    • /rec
      test.txt
      test_1.txt
      • /sd
        test_2.txt
  • JADE will download the test_1.txt from the /rec folder on the server and ignore the test.txt file whose name does not match with the file_spec regular expression.
  • JADE will create a /sd folder in the target a directory if this folder does not already exist.
  • It will the open the /rec/sd sub-folder on the server, create a corresponding folder on the target and download the test_2.txt file to this folder.

...

The JADE Client can filter files with zero bytes using the zero_byte_transfer parameter.

Example

The test_4.txt file on our test server has zero bytes and can be used to demonstrate the use of the zero_byte_transfer parameter.

...