- Example: Counting the number of files in the directory of an FTP site.
Example: Counting the number of files in the directory of an FTP site.
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
This page is also available for…