tumblr tracker

List

Library Reference ›› FTP ››
Parent Previous Next

FTP.List


Namespace: FTP


Lists the content (files and directories) of FTP folder.


retval = FTP.List(FtpClient, [Path])


Parameters:

- FtpClient; a handle variable returned from a previous call to CreateFtpClient;

- [Path]; optional; string constant or variable containing the slash delimited FTP path to list files and directories


Returns:

array of strings; files and/or directories contained; array value.


Example


$FtpClient = FTP.CreateFtpClient("moscripto.com", 21, "moscriptoftpdemo", "demopass");

if (Error.IsError())
{
   MessageBox.ShowError(Error.GetErrorMessage());
   Error.ClearError();
}
Else
{
   $FTPPaths = FTP.List($FtpClient, ""/*read the FTP root*/);
   ForEach ($FtpPath in $FTPPaths)
   {
       If (FTP.IsDirectory($FtpClient, $FtpPath))
       {
           MessageBox.ShowInfo("Path: " + $FtpPath + " is a directory.");
       }
       Else
       {
           MessageBox.ShowInfo("Path: " + $FtpPath + " is NOT a directory.");
       }
   }
   
   FTP.DestroyFtpClient($FtpClient);
}