ftpList

ftpList ( string server , string login , string password , string path , int _port , string _protocol ) : array

List files and folders on your server by FTP.

Example

files = ftpList("68.258.354.12","admin","sd44f88t4h","/var/www/download/")
for(file in files)
{
if(equals(get(file, "type"), "directory")) console("Directory:", true)
else if(equals(get(file, "type"), "file")) console("File:", true)
console(get(file, "filename"))
}
/*
Directory:img
File:toto.pdf
File:tata.zip
*/

Parameters

server

host

login

login of the server

password

password of the server

path

of the directory on your server. Use / to separate directories.

_port (optional)

default:21. For SFTP it is generally 22.

_protocol (optional)

default:"ftp"
Possible values:
• "ftp" : Normal FTP protocol
• "sftp" : Transfer over SSH
• "ftps" : Secure FTP or FTP over TLS/SSL (quite rare)

Return value

Return an array of map with 3 entries. The first with the key "filename" contains the name of the file (with extension), the second with the key "type" can be equals to "file" or "directory". The third is "last_modified" which contains a timestamp of the last modified date of the file in seconds.
Example:

[
	["filename":"img", "type":"directory", "last_modified":1668434052],
	["filename":"toto.pdf", "type":"file", "last_modified":1668435035],
	["filename":"tata.zip", "type":"file", "last_modified":1668437032],
]