|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-06-02 18:47 UTC] tjg at soe dot ucsc dot edu
Description: ------------ It would be really nice to have a function called: ssh2_sftp_ls($handle, $folder) It is currently not possible (without hacks) to list the files in a given directory on a remote sftp server with the ssh2 library. If possible (or as a replacement) it would also be nice to have: ssh2_sftp_glob($handle, $pattern) Both of these should return an array of file names. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 13:00:01 2025 UTC |
This can be done. Please consider this solution: $connection = ssh2_connect('localhost', 22); ssh2_auth_agent($connection, 'user'); $sftp = ssh2_sftp($connection); $folder = opendir("ssh2.sftp://$sftp/path/to/dir"); while (($file_name = readdir($folder)) !== false) { echo $file_name . "\n"; }