Versions Compared

Key

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

...

ProtocolFragments are not specified in this configuration as both source and target are on the local file system.  This has been done to allow write permissions at both source and target.

Profile

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

...

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 text specified in the  CumulativeFileSeparator parameter is incorporated in the cumulative file the CumulativeFile between the contents of the individual files.

Configuration structure

ProtocolFragment

ProtocolFragments are not specified in this configuration as both source and target are on the local file system. This has been done to allow write permissions at both source and target.

Profile

The three CumulateFiles elements are child elements of the TargetFileOptions element as can be seen in the screenshot below.

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

Image Added

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
languagebashxml
titleThe 'ftp_server_2_local_poll_minfiles' Profile in XML Format
collapsetrue
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
  <Fragments>
    <ProtocolFragments />
  </Fragments>
  <Profiles>
    <Profile profile_id="local_2_local_replace_datestamp">
     ...
    </Profile>
    <Profile profile_id="local_2_local_cumulate">
      <Operation>
        <Copy>
          <CopySource>
            <CopySourceFragmentRef>
              <LocalSource />
            </CopySourceFragmentRef>
            <SourceFileOptions>
[sftp_server_2_local_cumulate]
;;
 operation                 = copy
 file_spec<Selection>
                <FileSpecSelection>
                 = <FileSpec><![CDATA[^test_.\.txt$
;;
 cumulate_files  [0-9]\.txt$]]></FileSpec>
                  <Directory><![CDATA[${USERPROFILE}\jade_demo\a]]></Directory>
                </FileSpecSelection>
              </Selection>
            </SourceFileOptions>
          </CopySource>
          <CopyTarget>
            <CopyTargetFragmentRef>
              <LocalTarget />
          =  true</CopyTargetFragmentRef>
 cumulative_file_name            <Directory><![CDATA[${USERPROFILE}\jade_demo\b]]></Directory>
            <TargetFileOptions>
             = text-files.txt
 cumulative_file_separator = <CumulateFiles>
                <CumulativeFileSeparator><![CDATA[--- File: %{SourceFileName} ---
;;cumulative_file_delete   = true
;;
 source_host]]></CumulativeFileSeparator>
                <CumulativeFilename><![CDATA[text-files.txt]]></CumulativeFilename>
                <CumulativeFileDelete>true</CumulativeFileDelete>
              </CumulateFiles>
            </TargetFileOptions>
         = test.sos-berlin.com
 source_protocol </CopyTarget>
        </Copy>
      </Operation>
    </Profile>
  </Profiles>
</Configurations>
Code Block
languagetext
titleThe 'ftp_server_2_local_poll_minfiles' Profile in settings.ini Format
collapsetrue
[local_2_local_replace_datestamp]
...

[local_2_local_cumulate]
operation      = sftp
 source_ssh_auth_method    = password
 source_port               = 22copy
 source_userprotocol                     = demo
 source_passwordlocal
file_spec                           = demo
 ^test_[0-9]\.txt$
source_dir                = /
;;
 target_host        = ${USERPROFILE}\jade_demo\a
target_protocol      =   localhost
 target_protocol           = local
 target_dir                          = ${USERPROFILE}\jade_demo\ab
cumulate_files                      = true
cumulative_file_separator           = --- File: %{SourceFileName} ---
cumulative_file_name                = text-files.txt
cumulative_file_delete              = true
Running the Profile

This profile is called on Windows systems using the following command, depending on the JADE version being usedRun the example using:

Code Block
languagebash
titleRunning the file transfer configuration in Windows format using an XML (JADE 1.11 and later) or settings.ini file (JADE 1.10 and earlier)
jade.cmd -settings="%USERPROFILE%\jade_demo\local_2_local_select_adv.xml" -profile="local_2_local_cumulate"
jade.cmd -settings="%USERPROFILE%\jade_demo\local_2_local_select_adv.ini" -profile="local_2_local_cumulate"
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="sftp_server="local_2_local_cumulate"
./jade.sh -settings="${HOME}/jade_demo/local_2_local_select_adv.ini" -profile="local_2_local_cumulate"

Behavior

Opening the cumulative file text-files.txt in a text editor after transfer has been completed shows will show the order in which individual files were added to the cumulative file.

...