Transfer Commands for Sysax FTP Scripting

April 12th, 2014 by Rossy Guide

Introduction:

There are two file transfer commands that are used with Sysax FTP Scripting.

o  ftpdownload

o  ftpupload

The ftpdownload command can be used to download either an individual file or an entire folder tree. The files and folders are downloaded to the current local working path. The ftpupload command can be used to upload either an individual file or an entire folder tree. The files and folders are uploaded to the current remote working path.

Obtaining folder listings:

The contents of a folder can be listed and stored into a user specified list name. Each item in the list can then be individually accessed. The ftpgetlist command can be used to obtain a listing of the current working path. The predefined keywords local or remote are used to specify either the local or remote system. The recurse level determines the number of levels of subfolders that need to be listed. If no recurse level is specified, it is set to 1 by default and lists only the top level files and folders in the current working path.

Syntax for obtaining folder listings

ftpgetlist <keywords: local, remote>, <list name>, <recurse level>;

 

 

Example of using the command for setting paths

ftpgetlist local, @local_list; #get the listing of the 
current local working path
ftpgetlist remote, @remote_list; #get the listing of the 
current remote working path
ftpgetlist remote, @remote_list, 0; #get recursive listing of the 
current remote working path
ftpgetlist remote, @remote_list, 3; #get up to 3 levels of 
listings of the current remote working path

 

 

Transferring files and folders:

Download:

For this command, the predefined keywords file and folder are used to specify either a file or a folder. An optional local name string can be provided to save the downloaded item to a new name.

Syntax for downloading files and folders

ftpdownload <keywords: file, folder>, <remote name string>
 [, optional: <local name string>];

 

 

Examples of downloading files and folders

ftpdownload file, "text.dat"; #download file

ftpdownload file, "*.doc"; #download all files in the current 
folder matching the pattern *.doc

ftpdownload file, "text.dat", "text_0503.dat"; 
#download file and save as text_0503.dat

ftpdownload folder, "www"; #download entire folder tree

 

 

Upload:

For this command, the predefined keywords file and folder are used to specify either a file or a folder. An optional remote name string can be provided to save the uploaded item to a new name.

Syntax for uploading files and folders

ftpupload <keywords: file, folder>, <local name string>
 [, optional: <remote name string>];

 

 

Examples of uploading files and folders

ftpupload file, " out_text.dat"; #upload file

ftpupload file, "*.doc"; #upload all files in the current
 folder matching the pattern *.doc

ftpupload file, " out_text.dat", "out_text_0503.dat";
 #upload file and saving it as out_text_0503.dat

ftpupload folder, "www"; #upload entire folder tree

 

 

Modification time for remote file:

The ftpmodtime command can be used to get the modification time for the remote file in YYYYMMDDHHmmss format.

Syntax for modification time of a remote file

ftpmodtime <user variable>, <filename>;

 

 

Examples of modification time of a remote file

ftpmodtime ~remotefiletime, "remotefile.txt"; #get the modification 
time for remote file remotefile.txt

 

Comments are closed.