MultiScript - Extension Defined Functions - FS-FTP
Import Directive
To be able to use any of the FS-FTP defined MultiScript functions the functions must first be imported into the MultiScript engine. This is done with Import:
import("FSFTPScript");
FS-FTP Script Defined Functions.
FTPConnect | Connect to an FTP site |
FTPChdir | Change remote directory |
FTPMkdir | Create remote folder |
FTPRmdir | Remove remote folder |
FTPRemove | Remove remote file |
FTPRename | Rename remote file or folder |
FTPList | List the current remote directory |
FTPListCount | Number of items obtained from a previous FTPList command |
FTPListGet | Get list item |
FTPExists | Check if a remote file exists |
FTPPutFile | Upload a file |
FTPGetFile | Download a file |
FTPCommandRaw | Send a raw FTP command |
FTPQuit | Close an FTP Connection |
FTPConnect
Connect to an FTP site that is defined in bookmarks.
<handle> FTPConnect(<str> sitename);
Parameters
- sitename
- name of a site that is defined in FTP bookmarks.
Return value
A handle to an FTP site, or 0 if it fails to connect or if the sitename is not found in FTP bookmarks.
FTPChdir
Change remote directory.
<num> FTPChdir(<handle> conn, <str> path );
Parameters
- conn
- Handle to an FTP connection.
- path
- path to a location on the remote connection.
Return value
1 if successful or 0 if it fails.
FTPMkdir
Create directory in current remote location.
<num> FTPMkdir(<handle> conn, <str> directory);
Parameters
- conn
- Handle to an FTP connection.
- directory
- name of the directory to create.
Return value
1 if successful, 0 if it fails.
FTPRmdir
Remove a directory
<num> FTPRmdir( <handle> conn, <str> directory);
Parameters
- conn
- Handle to an FTP connection.
- directory
- name of the directory to remove.
Return value
1 if successful, 0 if it fails.
FTPRemove
Remove a remote file
<num> FTPRemove(<handle> conn <str> file);
Parameters
- conn
- Handle to an FTP connection.
- file
- Name of the remote file to remove.
Return value
1 if successful, 0 if it fails.
FTPRename
Rename a remote file or folder
<num> FTPRename(<handle> conn, <str> oldFilename, <str> newFilename);
Parameters
- conn
- Handle to an FTP connection.
- oldFilename
- Name of the remote file to rename.
- newFilename
- Filename the file should be renamed to.
Return value
1 if successful, 0 if it fails.
FTPList
Get the current directory content.
<num> FTPList(<handle> conn);
Parameters
- conn
- Handle to an FTP connection.
Return value
1 if successful, 0 if it fails.
Remarks
The result of a List command is cached in the FTP connection. Use FTPListGet to get the content if the list items.
FTPListCount
The number of list items that are stored in the connection.
<num> FTPListCount(<handle> conn);
Parameters
- conn
- Handle to an FTP connection.
Return value
The number of items obtained in the directory listing from a previous FTPList command.
FTPListGet
Get a list item.
<array> FTPListGet(<handle> conn, <num> index);
Parameters
- conn
- Handle to an FTP connection.
- index
- Index of the list item to get.
Return value
An array of 2 items where the first is the Name and the second is the size, or 0 if no item was found.
FTPExists
Check if a file or directory exists
<num> FTPExists(<handle> conn, <str> file;);
Parameters
- conn
- Handle to an FTP connection.
- file
- Filename or folder name to check for.
Return value
1 if the file exists, 0 if it does not.
Remarks
An FTPList command must have been run before running this command.
FTPPutFile
Upload a file.
<num> FTPPutFile(<handle> conn, <str> filepath, <str> remotefile);
Parameters
- conn
- Handle to an FTP connection.
- filepath
- filepath of the file to upload.
- remotefile
- The name of the file to store on the FTP server.
Return value
1 if successful, 0 if it fails.
FTPGetFile
Download file.
<num> FTPGetFile(<handle> conn, <str> remoteFile, <str> localfile);
Parameters
- conn
- Handle to an FTP connection.
- remoteFile
- Path to a remote file to download.
- localfile
- Path to a local filename to save the downloaded file as.
Return value
1 if successful, 0 if it fails.