ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / FTP functions
  • Example: Counting the number of files in the directory of an FTP site.
FTPListFile (Example)
Example: Counting the number of files in the directory of an FTP site.
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax This example is used to list the .JPG files found in the current directory of the "ftp.cdrom.com" site. For each file found by FTPListFile, the FileList procedure is executed. This procedure is used to count the number of files with the .JPG extension.
// Connection to an FTP site
nConnection is int
nConnection = FTPConnect("ftp.cdrom.com")
 
nFile is int      // Number of files in the directory
nJPG is int // Number of .JPG files
nJPG = 0
 
// List the files found in the current directory
nFile = FTPListFile(nConnection, "", "FileList", ftpFile, nJPG)
Info("There are" + nJPG + ".JPG files in" + nFile + "listed files")
// Procedure called by FTPListFile
PROCÉDURE FileList(Name, nSize, sAttribute, sDate, sTime, nParam)
IF Right(Name, 4) = ".JPG" THEN
nParam++
END
RESULT True
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo FtpListFile
//Conectar
n_conexao is int=ftp_conectar()
n_arquivos_Encontrados is int=FTPListeFichier(n_conexao,ftp_conf.endereco_remoto,arquivo_mostra_remoto,ftpFichier)

//---------------------------------------------------------
//Tem de Criar uma Tabela com as informacoes
//---------------------------------------------------------
//Aqui a procedure arquivo_mostra_remoto que vai ser chamado
//pelo ftplistfichier para cada arquivo que tem no servidor
//----------------------------------------------------------
PROCEDURE arquivo_mostra_remoto(nome_arquivo,tamanho,atributos,data,hora,parametro)
TableAddLine(TABLE_remoto,nome_arquivo,tamanho,data,hora)
RESULT True
//----------------------------------------------------------
//Blog com Video E Explicacao Ftp
//http://windevdesenvolvimento.blogspot.com.br/2016/01/windev21-curso-202-ftp-mostrar-arquivos.html
De matos AMARILDO
03 Jan. 2016

Last update: 05/26/2022

Send a report | Local help