PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Example: Count the number of files found in the directory of an FTP site.
FTPListFile (Example)
Example: Count the number of files found in the directory of an FTP site.
WEBDEV - Server codeAjax This example is used to list the .JPG files found in the current directory of the "ftp.cdrom.com" site. The FileList procedure is run for each file found by FTPListFile. This procedure is used to count the number of files with the .JPG extension.
// Connection to a FTP site
nConnection is int
nConnection = FTPConnect("ftp.cdrom.com")

nFile is int  // Number of files found 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
PROCEDURE 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