*
Metamerge logo
Search

Advanced Search
*
*
*
* HOME DOCUMENTS & RESOURCES DOWNLOADS EARLY TECH ACCESS SUPPORT FAQ KNOWN ISSUES OLD VERSIONS
*

The FTP Object

The FTP object is available as a scriptable object. This object is useful when the FTP Connector does not provide the required functionality.

Methods

Function Description
boolean connect (String host, String user, String pass) Connect to an FTP server using the host, user and pass.
boolean close () Close current FTP session
boolean get (String remoteFile, String localFile) Transfer remote file to local system
boolean put (String localFile, String remoteFile) Transfer local file to remote system
void setAscii () Set ASCII mode for file transfer
void setBinary () Set Binary mode for file transfer
boolean cd (String remoteDirectory) Change remote working directory
Object dir () Retrieve directory listing
boolean remove (String remoteFile) Remove file from FTP server
boolean rename (String file, String newname) Rename file on FTP server
Exception getLastError () Get the error object for the last operation

Example

var ftp = system.getFTP();

if ( ! ftp.connect ("ftpserver", "username", "password") )
{
	task.logsmg ("Connect failed: " + ftp.getLastError());
}

ftp.cd ("/home/user1");
var list = ftp.dir();
while ( list.next() )
{
	if (list.getType() == 1)
		task.logmsg ("Directory: " + list.getName());
	else
		task.logmsg ("File: " + list.getName());
}

ftp.setBinary();
ftp.get ("remotefile", "c:\\localfile");
ftp.put ("c:\\localfile", "remotefile");
 
*
  Metamerge Integrator version 4.5 ©Copyright Metamerge AS 2000-2002 Last edited 2002-04-30 contact us