Discuss this help topic in SecureBlackbox Forum

TElSimpleSFTPClient.ListDirectory

TElSimpleSFTPClient     See also     


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


Lists the contents of the directory on the remote server

Declaration

[C#]
    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 : TElList); overload;
    procedure ListDirectory(const Path : String; Listing : TElList; Recursive : boolean); overload;
    procedure ListDirectory(const Path : string; Listing : TElList; const Mask : string; CaseSensitive : boolean; IncludeFiles, IncludeDirectories : boolean); overload;
    procedure ListDirectory(const Path : string; Listing : TElList; const Mask : string; CaseSensitive : boolean; IncludeFiles, IncludeDirectories, Recursive : boolean); overload;

[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)

[Java]
    void listDirectory(String Path, ArrayList Listing, String Mask, boolean CaseSensitive, boolean IncludeFiles, boolean IncludeDirectories, boolean Recursive);
    void listDirectory(String Path, ArrayList Listing);
    void listDirectory(String Path, ArrayList Listing, boolean Recursive);
    void listDirectory(String Path, ArrayList Listing, String Mask, boolean CaseSensitive, boolean IncludeFiles, boolean IncludeDirectories);

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 the 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 the mask which can be a simple mask, a set of masks or a regular expression (read more about masks).
    Since SecureBlackbox version 13, file masks in group operations support expressions.

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

Discuss this help topic in SecureBlackbox Forum