Discuss this help topic in SecureBlackbox Forum

TElSimpleSFTPClient.ReadDirectory

TElSimpleSFTPClient     See also     


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


Reads the contents of the opened directory on the server.

Declaration

[C#]
    void ReadDirectory(byte[] Handle, ArrayList Listing);
    void ReadDirectory(byte[] Handle, ArrayList Listing, string Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ReadDirectory(byte[] Handle, ArrayList Listing, string Mask, string DirectoryMask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ReadDirectory(byte[] Handle, ArrayList Listing, string Mask, string DirectoryMask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories, bool Recursive, string Path);

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

[Pascal]
    procedure ReadDirectory(const Handle : TSBSftpFileHandle; Listing : TElList); overload;
    procedure ReadDirectory(const Handle : TSBSftpFileHandle; Listing : TElList; const Mask : string; CaseSensitive : boolean; IncludeFiles, IncludeDirectories : boolean); overload;
    procedure ReadDirectory(const Handle : TSBSftpFileHandle; Listing : TElList; const Mask : string; const DirectoryMask : string; CaseSensitive : boolean; IncludeFiles, IncludeDirectories : boolean); overload;
    procedure ReadDirectory(const Handle : TSBSftpFileHandle; Listing : TElList; const Mask : string; const DirectoryMask : string; CaseSensitive : boolean; IncludeFiles, IncludeDirectories, Recursive : boolean; Path : string); overload;

[C++]
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList &Listing);
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList *Listing);
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList &Listing, const std::string &Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList *Listing, const std::string &Mask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList &Listing, const std::string &Mask, const std::string &DirectoryMask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList *Listing, const std::string &Mask, const std::string &DirectoryMask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories);
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList &Listing, const std::string &Mask, const std::string &DirectoryMask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories, bool Recursive, const std::string &Path);
    void ReadDirectory(const std::vector<uint8_t> &Handle, TList *Listing, const std::string &Mask, const std::string &DirectoryMask, bool CaseSensitive, bool IncludeFiles, bool IncludeDirectories, bool Recursive, const std::string &Path);

[PHP]
    void ReadDirectory(array of byte|string|NULL $Handle, TList $Listing)
    void ReadDirectory(array of byte|string|NULL $Handle, TList $Listing, string $Mask, bool $CaseSensitive, bool $IncludeFiles, bool $IncludeDirectories)
    void ReadDirectory(array of byte|string|NULL $Handle, TList $Listing, string $Mask, string $DirectoryMask, bool $CaseSensitive, bool $IncludeFiles, bool $IncludeDirectories)
    void ReadDirectory(array of byte|string|NULL $Handle, TList $Listing, string $Mask, string $DirectoryMask, bool $CaseSensitive, bool $IncludeFiles, bool $IncludeDirectories, bool $Recursive, string $Path)

[Java]
    void readDirectory(byte[] Handle, ArrayList Listing, String Mask, String DirectoryMask, boolean CaseSensitive, boolean IncludeFiles, boolean IncludeDirectories, boolean Recursive, String Path);
    void readDirectory(byte[] Handle, ArrayList Listing, String Mask, String DirectoryMask, boolean CaseSensitive, boolean IncludeFiles, boolean IncludeDirectories);
    void readDirectory(byte[] Handle, ArrayList Listing, String Mask, boolean CaseSensitive, boolean IncludeFiles, boolean IncludeDirectories);
    void readDirectory(byte[] Handle, ArrayList Listing);

Parameters

  • Handle - handle to opened directory, returned by OpenDirectorymethod
  • Listing - the list will be filled by instances of the TElSftpFileInfo class, which represent the entries in the remote directory
  • NamesOnly - if the value is True, only the names of the files are returned.If the value is False, the following information is returned:&lt;Name&gt;&lt;SP&gt;\&lt;SP&gt;&lt;TYPE&gt;&lt;SP&gt;&lt;SIZE&gt;&lt;SP&gt;&lt;AccessTime&gt;&lt;SP&gt;&lt;ModificationTime&gt;&lt;SP&gt;&lt;CreationTime&gt;.Time is expressed in GeneralizedTime format.
    If some parameter is not returned by the server, dash ("-") is put instead.
    The list can be extended further, so the parser should not expect CreationTime to be the last parameter, followed by any specific character.
  • 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.
  • DirectoryMask - specifies the directory mask.
  • Recursive - set this parameter to True to perform a recursive search, i.e., including subdirectories.
  • Path - specifies the path to the directory.

Description

    Use this method to read contents from the opened directory. Do not pass the handle to the opened file as Handle.
    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.
    ReadDirectory should be called once. It returns the complete directory contents. The client must close the handle using the CloseHandle method.

    Use ListDirectory as a simpler alternative to ReadDirectory. ListDirectory doesn't require you to open and close the directory.

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

See also:     Read     OpenDirectory     ListDirectory    

Discuss this help topic in SecureBlackbox Forum