Cicode Programming Reference > Cicode Function Categories > FTP Functions Introduction > FTPFileFind

FTPFileFind

Finds a file on the FTP server that matches a specified search criteria. Before you can call this function, you need to call FTPOpen(). This function can only be used on the Internet Display Client.

To find a list of files, you need to first call this function twice: once to find the first file, then again with an empty path to find the remaining files. After the last file is found, an empty string is returned.

If the search is for multiple files, FTPFileFindClose needs to be called if the search does not run to completion (for example, you do not run until an empty string is returned).

Syntax

FTPFileFind(hndFTP, sPath)

hndFTP:

The handle of a valid FTP session, as returned by FTPOpen().

sPath:

The path you want to search for the desired file. Do not use path substitution here. To search for multiple files, the wildcards * and ? may be used to match multiple entries.

nMode:

The type of file to check:

0 - Normal files (includes files with read-only and archived attributes)

1 - Read-only files only

2 - Hidden files only

4 - System files only

16 - Subdirectories only

32 - Archived files only

128 - Files with no attributes only

These numbers can be added together to search for multiple types of files during one search.

Return Value

The full path and filename. If no files are found, an empty string is returned.

Related Functions

FTPFileCopy, FTPOpen

Example

INT hFtp;
STRING sFindPath;
STRING sPath;
sFindPath = "\User\Example\*.RDB";
hFtp = FtpOpen("", "", "");
sPath = FtpFileFind(hFtp, sFindPath);
WHILE StrLength(sPath) > +0 DO
sPath = FtpFileFind(hFtp, "");
END
FtpClose(hFtp);

See Also

FTP Functions