Versions Compared

Key

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

...

This is the fourth in a series of articles describing how to get started with using the the JADE Client via its Command Line Interface.The articles in this series are:

JADE Tutorials List

JADE Client Command Line Interface

  1. Getting Started and Downloading files
  2. Simple File Selection
  3. More Advanced File Selection
  4. File Transfer

  5. Checking files for completeness
  6.  Public / Private Key Authentication 
  7. Transfer via a Jump Host / DMZ

JADE Background Service

  1. Installation, Configuration and Use

Prerequisites

See the For setting-up and running the examples see Using the tutorials with the JADE Client Command Line Interface article for guidelines to setting up and running the tutorial examples.

Instructions for installing, configuring and using the XML Editor can be found in the XML Editor series of articles.

Download file

The configuration described in this tutorial can be downloaded and then directly opened in the XML Editor using the following link:

  • sos-berlin_demo_2_local_select_adv.xml

File Transfer Examples

Renaming files

...

  • Renaming files
  • Adding a date-stamp to file names

See the JADE Parameter Reference - Rename article for a full list of the renaming possibilities.

Example

The file name part(s) to be replaced is/are defined in the replacing parameter with round brackets () and the new part(s) in the replacement parameter, separated by semi-colons.

...

  • test will be replaced with file_ and
  • '_' with the current date in the format specified.

Configuration structure

ProtocolFragment

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

Profile

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

FileSpec

The value of the FileSpec element was changed to ^test_.\.txt$. Five files will be found in the transfer source directory.

Polling Elements

The Polling parent element is added as a child of the SourceFileOptions element. In the example profile shown in the XML Editor screenshot below the function of the three poll_* parameters should be self-explanatory but the following should be noted:

  • poll_interval - is specified in seconds (only integer values)

  • poll_timeout - is specified in minutes (only integer values)

  • poll_minfiles - optional - can only be used together with poll_timeout

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
languagebash
title'local_2_local_replace_datestamp' 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">
      <Operation>
        <Copy>
          <CopySource>
            <CopySourceFragmentRef>
              <LocalSource>
                <Rename>
                  <ReplaceWhat><![CDATA[^(test)(_)[0-9]\.txt]]></ReplaceWhat>
                  <ReplaceWith><![CDATA[file_;[date:yyyy-MM-dd]_]]></ReplaceWith>
                </Rename>
              </LocalSource>
            </CopySourceFragmentRef>
            <SourceFileOptions>
[replace_local_datestamp]
;;
 operation                 = copy
 file_spec<Selection>
                <FileSpecSelection>
                 = <FileSpec><![CDATA[^test_[0-9]\.txt$]]></FileSpec>
                  <Directory><![CDATA[${USERPROFILE}\jade_demo\a]]></Directory>
                </FileSpecSelection>
              </Selection>
            </SourceFileOptions>
          </CopySource>
          <CopyTarget>
            <CopyTargetFragmentRef>
              <LocalTarget />
            </CopyTargetFragmentRef>
            <Directory><![CDATA[${USERPROFILE}\jade_demo\b]]></Directory>
          </CopyTarget>
        </Copy>
      </Operation>
    </Profile>
  </Profiles>
</Configurations>
Code Block
languagebash
title'local_2_local_replace_datestamp' Profile in settings.ini Format
collapsetrue
[local_2_local_replace_datestamp]
operation                           = copy
source_protocol                     = local
source_replacing   
;;
 replacing                 = ^(test)(_)[0-9]\.txt
source_replacement  replacement                = file_;[date:yyyy-MM-dd]_
;;
 source_hostfile_spec               = localhost
 source_protocol           = local
 ^test_[0-9]\.txt$
source_dir                          = ${USERPROFILE}\jade_demo\a
;;
 target_hostprotocol                     = localhostlocal
 target_protocol  dir         = local
 target_dir                = ${USERPROFILE}\jade_demo\b
Running the Profile

This profile is called on Windows systems using the following command, depending on the JADE version being usedCall the 'replace_local_datestamp' profile by entering the following in the command line:

Code Block
languagebash
titleRunning the file transfer settings.ini 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_replace_datestamp"
jade.cmd -settings="%USERPROFILE%\jade_settings_demo\local_2_local_select_adv.ini" -profile="replacelocal_2_local_replace_datestamp"

Behavior

The five test_*.txt files in the the a folder will be copied to the b folder and parts of their names will be replaced as described above.

...