...
- Getting Started and Downloading files
- Simple File Selection
- More Advanced File Selection
- File Transfer
- Checking files for completeness
- Public / Private Key Authentication
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 file can be downloaded and then directly opened in the XML Editor from the following link:
File Selection - More Complex Examples
...
JADE will transfer all those files it has found at the end of the polling interval if the minimum number of matches has not been reached.
Example
.
Configuration structure
ProtocolFragment
The ftp_demo_sos-berlin ProtocolFragment used in the first tutorial in this series will be reused.
Profile
The example presented in this tutorial uses a Profile based on the ftp_server_to_local Profile described in the first tutorial in this series.
The new Profile, has been given the profile_id = ftp_server_to_local_poll and the following changes have been made:
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 In the example profile listed below the function of the four 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
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 | ||||||||
---|---|---|---|---|---|---|---|---|
| [sftp
| |||||||
<?xml version="1.0" encoding="utf-8"?> <Configurations xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/schema/jade/JADE_configuration_v1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Fragments> <ProtocolFragments> <FTPFragment name="ftp_demo_sos-berlin"> <BasicConnection> <Hostname><![CDATA[test.sos-berlin.com]]></Hostname> </BasicConnection> <BasicAuthentication> <Account><![CDATA[demo] ;; operation]></Account> <Password><![CDATA[demo]]></Password> </BasicAuthentication> </FTPFragment> </ProtocolFragments> </Fragments> <Profiles> <Profile profile_id= copy file_spec"ftp_server_2_local_poll_minfiles"> <Operation> <Copy> <CopySource> <CopySourceFragmentRef> <FTPFragmentRef ref="ftp_demo_sos-berlin" /> </CopySourceFragmentRef> <SourceFileOptions> <Selection> <FileSpecSelection> = <FileSpec><![CDATA[^test_[0-9]\.txt$ ;; poll_interval .\.txt$]]></FileSpec> <Directory><![CDATA[./]]></Directory> </FileSpecSelection> </Selection> <Polling> <PollInterval>20</PollInterval> <PollTimeout>1</PollTimeout> <MinFiles>3</MinFiles> </Polling> </SourceFileOptions> </CopySource> <CopyTarget> = 20<CopyTargetFragmentRef> poll_timeout <LocalTarget /> = 1 poll_minfiles</CopyTargetFragmentRef> <Directory><![CDATA[${USERPROFILE}\jade_demo\a]]></Directory> </CopyTarget> </Copy> </Operation> </Profile> </Profiles> </Configurations> |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
[protocol_fragment_ftp@ftp_demo_sos-berlin] protocol = 3 poll_keep_connection = trueftp ;; source_host host = test.sos-berlin.com source_protocoluser = sftpdemo source_ssh_auth_methodpassword = demo [ftp_server_2_local_poll_minfiles] operation = password source_port = 22copy source_userinclude = protocol_fragment_ftp@ftp_demo_sos-berlin source_passwordfile_spec = demo ^test_.\.txt$ source_dir = / ;; target_host./ poll_interval = 20 poll_timeout = 1 poll_minfiles = localhost3 target_protocol = local target_dir = ${USERPROFILE}\jade_demo\a |
...
Running the Profile
This profile is called on Windows systems using one of the following commands, depending on the JADE version being used profile by entering the following in the Windows command line:
Code Block | ||||
---|---|---|---|---|
| ||||
jade.cmd -settings="%USERPROFILE%\jade_demo\sos-berlin_demo_2_local_poll.ini" -profile="ftp_server_2_local_poll_minfiles" |
Code Block | ||||
---|---|---|---|---|
| ||||
jade.cmd -settings="%USERPROFILE%\jade_demo\sos-berlin_demo_2_local_poll.xml" -profile="ftp_server_2_local_poll_minfiles" |
On Unix systems the profile is called using one of the following commands, depending on the JADE version being used:
Code Block | ||||
---|---|---|---|---|
| ||||
./jade.sh -settings="${HOME}/jade_demo/sos-berlin_demo_2_local_poll.ini" -profile="ftp_server_2_local_poll_minfiles" |
Code Block | ||||
---|---|---|---|---|
| ||||
./jade.sh -settings="${HOME}/jade_demo/sos-berlin_demo_2_local_poll.xml" -profile="sftpftp_server_2_local_poll_minfiles" |
...