Ftp Commands-j (JScape Library)

This task allows you to connect to an ftp server and issue
commands. There are two types of commands supported:
1) The
standard ftp commands as defined in RFC 959. Please
see list of ftp commands. Only the most useful commands are
listed here. Please search the Internet for RFC 959 if you need
more information on all the standard Ftp commands.
2) Custom
functions provided by the Ftp Command task. Please
see list of custom functions.
Please note that the ftp commands, that you normally use in the
ftp command-line tools in MSDOS, MacOSX or Unix etc. are not
necessarily supported. For example, the LS, CD, Get or Put
commands, in many command-line ftp tools are not valid RFC 959 ftp
commands. Get and Put are commands created by many command-line
ftp tools to implement the RETR and STOR commands, of RFC 959.
To put or get files, you can use the custom functions $$GET&
$$PUT that are provided by this task.
This task is multithreaded. So you can run multiple Ftp
Command tasks simultaneously.
This task also outputs dynamic variables for each response
provided by the Ftp server. The variables syntax is:
TaskTitle::ResponseX. X is the response from the server for
each of your Ftp commands. You can use these response variables
in a Variable Monitor task to do conditional processing.
Profiles
Enter the profile name for the ftp
server.
Commands
Enter your ftp commands, 1 per line.
The custom commands are case sensitive. This field also
supports dynamic variables. Using
dynamic variables, you can enter a command which will be dynamically
resolved at runtime. example: cd /users/$%USERNAME%$
Example1
PWD
prints current remote ftp directory
CWD
/users/tom
sets /users/tom as the current ftp directory
$$LCD::c:\test
sets c:\test as the current local directory
$$MPUT::test
puts all files from c:\test, which include 'test' in their name, to
/users/tom
$$MGET::
gets all files from /users/tom to c:\test
Example2
PWD
prints current remote ftp directory
CWD
/users/tom
sets /users/tom as the current ftp directory
$$LCD::c:\test
sets c:\test as the current local directory
$$PASV
sets the passive mode of transfer
$$GET::test.txt
gets test.txt from /users/tom to c:\test
$$PUT::test.txt
puts test.txt from c:\test to /users/tom
List of custom
commands
$$LCD
|
Description: Sets the current local folder
Syntax: $$LCD::path_to_local_folder Example:
$$LCD::c:\data\test Comments: Very important.
Should always be set before transferring files Comments:
Internal module use only. Ftp server has no idea about
current local folder Comments: Used
internally by $$PUT, $$GET, $$MPUT, $$MGET, $$MDEL functions
|
$$CD
|
Description: Sets the current working ftp directory
Syntax: $$CD::path_to_remote_directory Example:
$$CD::/test/backup Comments: Very important.
Should always be set before transferring files.
|
$$PASV
|
Description: Sets the passive mode of transfer.
Syntax: $$PASV
|
$$PUT
|
Description: Puts a single file from current local
folder, to current remote ftp folder Syntax:
$$PUT::filename Example: $$PUT::test.txt
Comments: Only single file is put, file should exist in
current local folder
|
$$GET
|
Description: Gets a single file from current remote ftp
folder to current local folder Syntax:
$$GET::filename Example: $$GET::test.txt
Comments: Only single file is got, file should exist in
current remote ftp folder
|
$$MPUT
|
Description: Puts multiple files from current local
folder to current ftp folder Syntax:
$$MPUT::filename_filter Example:
$$MPUT:: (will put all files from current local folder) Example:
$$MPUT::test will put all files which include test in their name)
Example: $$MPUT::.txt^.htm (will put all files which have .txt or .htm extensions)
Comments: Enter the filename_filter using
the following wildcard rules
|
$$MGET
|
Description: Gets multiple files from current ftp
folder, to current local folder Syntax:
$$MGET::filename_filter Example:
$$MGET::* (will get all files from current ftp folder) Example:
$$MGET::test (will put all files which include test in their name);
Example: $$MGET::.txt^.htm (will put all files which have .txt or .htm extensions);
Comments: Enter the filename_filter using
the following wildcard rules Comments:
Automatically detects directory listing style and get directory
information
|
$$MSGET
|
Description: Gets multiple files and directories from current ftp folder
to current local folder Syntax:
$$MSGET::* (will get all files and directories from current ftp folder) Example:
$$MSGET::test (will get all files and directories which include test in their name)
Example: $$MSGET::.txt^.htm (will put all files which have .txt or .htm extensions)
Comments: Enter the filename_filter using
the following wildcard rules Comments:
It will also try to GET directories, if they satisfy the
filename filter.
|
$$MSPUT
|
Description: Puts multiple files and directories from current local folder
to current ftp folder Syntax:
$$MSPUT::* (will put all files and directories from current ftp folder) Example:
$$MSPUT::test (will put all files and directories which include test in their name)
Example: $$MSPUT::.txt^.htm (will put all files which have .txt or .htm extensions)
Comments: Enter the filename_filter using
the following wildcard rules Comments:
It will also try to PUT directories, if they satisfy the
filename filter.
|
$$MNFGET
|
Description: Gets multiple files from current ftp folder
to current local folder Syntax:
$$MNFGET::* (will get all files from current ftp folder) Example:
$$MNFGET::test (will get all files which include test in their name)
Example: $$MNFGET::.txt^.htm& (will get all files which have .txt or .htm extensions)
Comments: Enter the filename_filter using
the following wildcard rules Comments: Only obtains
names of objects in current ftp directory This function
does not try to detect if object is a File or a Directory.
It will also try to GET directories, if they satisfy the
filename filter. This results in the following error
being output, for every Directory in current ftp folder:
550 dir_name: [Error information varies by ftp server].
This is expected behavior. This function is useful when the library cannot parse a full directory listing and can only use a Names only list
|
$$MNDGET
|
Description: Gets multiple directories from current ftp folder
to current local folder Syntax:
$$MNDGET::* (will get all directories from current ftp folder) Example:
$$MNDGET::test (will get all files which include test in their name)
Example: $$MNDGET::.txt^.htm (will get all files which have .txt or .htm extensions)
Comments: Enter the filename_filter using
the following wildcard rules Comments: Only obtains
names of objects in current ftp directory This function
does not try to detect if object is a File or a Directory.
It will also try to GET file, if they satisfy the
filename filter. This results in the following error
being output, for every File in current ftp folder:
550 file_name: [Error information varies by ftp server].
This is expected behavior. This function is useful when the library cannot parse a full directory listing and can only use a Names only list
|
$$MNFRGET
|
Description: Gets multiple files from current ftp folder
to current local folder when the directory listing cannot be parsed by the FTP library. You need to specify the total columns and the column number which contains the file names. Syntax:
$$MNFRGET::filter::start_row::number_columns::filename_column_number Example:
$$MNFRGET::test::2::10::10 (will get all files which include test in their name)
filter = Enter the filename filter using
the following wildcard rules start_row = 1 if listing contains no header row. 2 or greater if listing contains header row(s). number_columns = total columns in directory listing row. name_column_number = column number which contains the filename
Comments: Only obtains
names of objects in current ftp directory This function
does not try to detect if object is a File or a Directory.
It will also try to GET directory, if they satisfy the
filename filter. This results in the following error
being output, for every Directory in current ftp folder:
550 file_name: [Error information varies by ftp server].
This is expected behavior.
This function is useful when the FTP library cannot parse a directory listing. This function uses Hitek Software code to try and parse the directory listing to get a list of file names to download.
|
$$MDEL
|
Description: Deletes multiple files from current ftp
folder Syntax: $$MDEL::filename_filter
Example: $$MDEL::
(will delete all files from current remote ftp folder)
Example: $$MDEL::test
(will delete all files which include test in their name)
Example: $$MDEL::.txt^.htm
(will delete all files which have .txt or .htm extensions)
Comments: Enter the filename_filter using
the following wildcard rules
|
$$MLDEL
|
Description: Deletes multiple files from current local
folder Syntax: $$MLDEL::filename_filter
Example: $$MDEL::
(will delete all files from current local folder) Example:
$$MDEL::test
(will delete all files which include test in their name)
Example: $$MDEL::.txt^.htm
(will delete all files which have .txt or .htm extensions)
Comments: Enter the filename_filter using
the following wildcard rules
|
List of useful ftp commands - RFC 959
HELP
|
Description: Returns list of commands or details for a
single command Syntax: HELP [command]
Example: HELP
returns a list of commands supported by the ftp server
Example: HELP USER
returns details on the USER command
|
USER
|
Description: Sends the username to begin the login
process Syntax: USER userID Example:
USER tom
|
PASS
|
Description: After sending the USER command, send this
command to complete login Syntax: PASS
user_password Example: PASS ergts56r
|
PASV
|
Description: Sets the passive mode of transfer.
Syntax: PASV
|
TYPE
|
Description: Specifies Ascii or binary mode of data
transfer Syntax: TYPE mode Example:
TYPE I or TYPE A
Comments: A - ASCII text, E - EBCDIC text, I - image
(binary data)
|
PORT
|
Description: Specifies host & port to which the ftp
server should connect for next data transfer Syntax:
PORT h1,h2,h3,h4,p1,p2 Example: PORT
192,168,0,121,15,196 Comments: ip address =
h1.h2.h3.h4, port = p1*256 + p2
|
ACCT
|
Description:Sends the account required for login
Syntax: ACCT account_name Comments:
normally sent after the PASS command. Uncommon command
|
CWD
|
Description: Sets the current ftp directory on remote
ftp server Syntax: CWD remote_ftp_path
Example: CWD /users/tom/data
|
CDUP
|
Description: Sets the parent of the current ftp folder
to be the current ftp folder Syntax: CDUP
|
DELE
|
Description: Deletes a single file from the current ftp
folder Syntax: DELE filename Example:
DELE test.txt
|
RNFR
|
Description: Used to rename a file. Specifies the
file to be renamed Syntax: RNFR original_name
Example: RNFR test.txt Comments:
Should be followed by RNTO command
|
RNTO
|
Description: Used to rename a file. Specifies the
new name for the file Syntax: RNTO new_name
Example: RNTO new.txt Comments: Should
be preceded by RNFR command
|
SITE
|
Description: Used to issue a site specific command
Syntax: SITE command Example: Use
'HELP SITE' to see list and syntax of supported commands
Comments: May not be supported by many Ftp servers
|
RETR
|
Description: Transfers file from remote host
Syntax: RETR filename Example: RETR
test.txt Comments: Should be preceded
by the PORT or PASV commands
|
STOR
|
Description: Transfers file to the remote host
Syntax: STOR filename Example: STOR
test.txt Comments: Should be preceded by the PORT
or PASV commands
|