note 82726 added to function.ssh2-sftp

From: Date: Wed, 23 Apr 2008 15:38:55 +0000
Subject: note 82726 added to function.ssh2-sftp
Groups: php.notes 
Request: Send a blank email to php-notes+get-138701@lists.php.net to get a copy of this message
if anyone is interested on how to get a directory listing: $SSH_CONNECTION= ssh2_connect('shell.example.com', 22); ssh2_auth_password($SSH_CONNECTION, 'username', 'password'); //------------------------------------------------------------------- //this function finds all files within given directory and returns them function scanFilesystem($dir) { $tempArray = array(); $handle = opendir($dir); // List all the files while (false !== ($file = readdir($handle))) { if (substr("$file", 0, 1) != "."){ if(is_dir($file)){ $tempArray[$file]=scanFilesystem("$dir/$file"); } else { $tempArray[]=$file; } } } closedir($handle); return $tempArray; } //------------------------------------------------------------------- $sftp = ssh2_sftp($SSH_CONNECTION); //code to get listing of all OUTGOING files $dir = "ssh2.sftp://$sftp/outgoing"; $outgoing = scanFilesystem($dir); sort($outgoing); print_r($outgoing); ---- Server IP: 64.71.164.2 Probable Submitter: 131.216.61.192 ---- Manual Page -- http://www.php.net/manual/en/function.ssh2-sftp.php Edit -- https://master.php.net/note/edit/82726 Del: integrated -- https://master.php.net/note/delete/82726/integrated Del: useless -- https://master.php.net/note/delete/82726/useless Del: bad code -- https://master.php.net/note/delete/82726/bad+code Del: spam -- https://master.php.net/note/delete/82726/spam Del: non-english -- https://master.php.net/note/delete/82726/non-english Del: in docs -- https://master.php.net/note/delete/82726/in+docs Del: other reasons-- https://master.php.net/note/delete/82726 Reject -- https://master.php.net/note/reject/82726 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138701) next »