note 96918 added to function.ssh2-sftp

From: Date: Tue, 23 Mar 2010 08:25:53 +0000
Subject: note 96918 added to function.ssh2-sftp
Groups: php.notes 
Request: Send a blank email to php-notes+get-167305@lists.php.net to get a copy of this message
I wanted to have a recursive scanFilesystem, so i modified the function a bit: function scanFilesystem($remote_file,$recursive = false) { $sftp = $this->sftp; $dir = "ssh2.sftp://$sftp$remote_file"; $stream = fopen("ssh2.sftp://$sftp$remote_file",'r'); $tempArray = array(); $handle = opendir($dir); // List all the files while (false !== ($file = readdir($handle))) { if (!in_array($file,array('.','..'))){ //other directories that U don't want scanned should be placed here if(is_dir($dir.'/'.$file) and $recursive){ $tempArray[$file] = $this->scanFilesystem("$remote_file/$file"); }else{ $tempArray[]=$file; } } } closedir($handle); return $tempArray; } Cheers, Ceco ---- Server IP: 69.147.83.197 Probable Submitter: 95.111.43.40 ---- Manual Page -- http://www.php.net/manual/en/function.ssh2-sftp.php Edit -- https://master.php.net/note/edit/96918 Del: integrated -- https://master.php.net/note/delete/96918/integrated Del: useless -- https://master.php.net/note/delete/96918/useless Del: bad code -- https://master.php.net/note/delete/96918/bad+code Del: spam -- https://master.php.net/note/delete/96918/spam Del: non-english -- https://master.php.net/note/delete/96918/non-english Del: in docs -- https://master.php.net/note/delete/96918/in+docs Del: other reasons-- https://master.php.net/note/delete/96918 Reject -- https://master.php.net/note/reject/96918 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167305) next »