Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Initial save after change to XML

...

Configuration structure

ProtocolFragment

There ProtocolFragments are no ProtocolFragments not specified in this configuration as both source and target are on the local file system. 

...

The meaning of the three elements required to specify renaming - Rename, ReplaceWhat and ReplaceWith elements should be self-explanatory.

Note that
  • the Rename operation in this example described here is specified for the transfer source, meaning that the source files will be renamed and that the files copied to the target will not be. It is also possible to specify Rename for the transfer target, in which case the source files will remain unchanged for a copy operation.
  • write permissions are required before names of files on a file system can be changed.
XML Editor Configuration

The Profile Code

The following code boxes can be opened to show the Profile and ProtocolFragments used in this example in XML and in settings.ini formats.

...

Code Block
languagebash
titleRunning the file transfer configuration in Unix format using an XML (JADE 1.11 and later) or settings.ini file (JADE 1.10 and earlier)
./jade.sh -settings="${HOME}/jade_demo/local_2_local_select_adv.xml" -profile="local_2_local_replace_datestamp"
./jade.sh -settings="${HOME}/jade_demo/local_2_local_select_adv.ini" -profile="local_2_local_replace_datestamp"

Behavior

  • The five test_*.txt files in the the a folder will be copied to the b folder

...

  • under their original names. The source files will then be

...

  • renamed as described above.
  • If a file is found but not transferred - because for example it has zero bytes and TransferZeroByteFiles is set to false then the file will remain.

File cumulation

JADE can cumulate the contents of individual files to a single target file:

  • Files matching the file_spec regular expression are cumulated together into a new file.
  • The CumulativeFileDelete element is used to specify whether an already existing CumulativeFile is deleted and a new, empty, CumulativeFile created before the content of the individual files being transferred is added to this file. (The CumulativeFile is by default opened in append mode.)
  • The individual, original files can be deleted if required in a separate operation.
  • There is not a de-cumulate parameter available at the moment.

Example

The example profile downloads the five textassumes that five test_*.txt files from our demo server and adds their contents successively to a cumulative file.have previously been downloaded to the local ${USERPROFILE}\jade_demo\a directory before the example is run.

In the example, the contents of these five files written to a CumulativeFile in the local ${USERPROFILE}\jade_demo\b directory. The content of each file being transferred is added successively to the CumulativeFile in the order in which the files are received. This order cannot be controlled during the file transfer operation.

The CumulativeFile is The cumulative file is then given the name specified in the cumulative_file_name CumulativeFileName parameter in the profile.

The text specified in the  cumulative_file_separator CumulativeFileSeparator parameter is incorporated in the cumulative file between the contents of the individual files.The order in which the files are added to the cumulative file is not fixed but depends on the order in which the files arrive on the local file system.

 

Code Block
languagebash
[sftp_server_2_local_cumulate]
;;
 operation                 = copy
 file_spec                 = ^test_.\.txt$
;;
 cumulate_files            = true
 cumulative_file_name      = text-files.txt
 cumulative_file_separator = --- File: %{SourceFileName} ---
;;cumulative_file_delete   = true
;;
 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

...