Discuss this help topic in SecureBlackbox Forum

TElSimpleSFTPClient.ListDirectory

TElSimpleSFTPClient     See also     


Filter: C#/Java  VB.NET  Pascal  C++  PHP  


Lists the contents of the directory on the remote server

Declaration

[C#/Java]
    void ListDirectory(string Path, ArrayList Listing);
    void ListDirectory(string Path, ArrayList Listing, bool Recursive);
    void ListDirectory(string Path, ArrayList Listing, string Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ListDirectory(string Path, ArrayList Listing, string Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories, bool Recursive);

[VB.NET]
    Sub ListDirectory(ByVal Path As String, ByVal Listing As ArrayList)
    Sub ListDirectory(ByVal Path As String, ByVal Listing As ArrayList, ByVal Recursive As Boolean)
    Sub ListDirectory(ByVal Path As String, ByVal Listing As ArrayList, ByVal Mask As String, ByVal CaseSensitive As Boolean, ByVal IncludeFiles As Boolean, ByVal IncludeDirectories As Boolean)
    Sub ListDirectory(ByVal Path As String, ByVal Listing As ArrayList, ByVal Mask As String, ByVal CaseSensitive As Boolean, ByVal IncludeFiles As Boolean, ByVal IncludeDirectories As Boolean, ByVal Recursive As Boolean)

[Pascal]
    procedure ListDirectory(const Path: string; Listing: TList);
    procedure ListDirectory(const Path: string; Listing: TList; Recursive: boolean);
    procedure ListDirectory(const Path: string; Listing: TList; Mask: string; CaseSensitive: boolean; IncludeFiles, IncludeDirectories: boolean);
    procedure ListDirectory(const Path: string; Listing: TList; Mask: string; CaseSensitive: boolean; IncludeFiles, IncludeDirectories, Recursive: boolean);
    
    type TSBSftpFileHandle = ByteArray;

[C++]
    void ListDirectory(const std::string &Path, TList &Listing);
    void ListDirectory(const std::string &Path, TList *Listing);
    void ListDirectory(const std::string &Path, TList &Listing, bool Recursive);
    void ListDirectory(const std::string &Path, TList *Listing, bool Recursive);
    void ListDirectory(const std::string &Path, TList &Listing, const std::string &Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ListDirectory(const std::string &Path, TList *Listing, const std::string &Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ListDirectory(const std::string &Path, TList &Listing, const std::string &Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories, bool Recursive);
    void ListDirectory(const std::string &Path, TList *Listing, const std::string &Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories, bool Recursive);

[PHP]
    void ListDirectory(string $Path, TList $Listing)
    void ListDirectory(string $Path, TList $Listing, bool $Recursive)
    void ListDirectory(string $Path, TList $Listing, string $Mask, bool $CaseSensitive, bool $IncludeFiles, bool $IncludeDirectories)
    void ListDirectory(string $Path, TList $Listing, string $Mask, bool $CaseSensitive, bool $IncludeFiles, bool $IncludeDirectories, bool $Recursive)

Parameters

  • Path - path to the directory to read
  • Listing - the list will be filled by instances of the TElSftpFileInfo class, which represent the entries in the remote directory
  • Mask - specifies the mask (wildcards) to select the names. Only the names of the files and directories, that match the mask, will be returned.
    Note, that SFTP doesn't support name masks, so no matter what mask you specify, the whole directory will be read and then scanned for matches.
  • CaseSensitive - specifies whether the mask is case-sensitive.
  • IncludeFiles - specifies whether the names of the files and symlinks is returned.
  • IncludeDirectories - specifies whether the names of the directories is returned.
  • Recursive - set this parameter to True to perform a recursive search, i.e., including subdirectories.

Description

    Use this method to list contents of the directory.
    In case of error, EElSFTPError exception containing SFTP error code, is raised. For more information on error handling, please read the corresponding how-to article.
    ListDirectory should be called once per enumeration: it returns the complete directory contents.

    Files are chosen by mask which can be a simple mask, set of masks or regular expression (read more about masks).

     [Pascal]  Note, all TElSftpFileInfo objects returned by this function are not destroyed by TElSimpleSFTPClient and thus *must* be freed by user application.

See also:     About file masks and regular expressions     ReadDirectory    

Discuss this help topic in SecureBlackbox Forum