note 29420 added to function.ftp-nlist

From: Date: Thu, 13 Feb 2003 02:25:10 +0000
Subject: note 29420 added to function.ftp-nlist
Groups: php.notes 
Request: Send a blank email to php-notes+get-43856@lists.php.net to get a copy of this message
There are some FTP servers that just dont accept the ftp_nlist command, they return a bool variable. but I think all of them accept the LIST command which is the ftp_rawlist command. So yu have to parse rawlist to nlist. I found a code here posted by "fredrik" but it shows a bug if the files at the ftp server have spaces oon theeir name... so here its a better function: function rawlist_2_nlist($list) { $newlist = array(); reset($list); while (list(,$row) = each($list)) { $buf=""; if ($row[0]=='d'||$row[0]=='-'){ $buf = substr($row,55); $newlist[]=$buf; } } return $newlist; } -- http://www.php.net/manual/en/function.ftp-nlist.php http://master.php.net/manage/user-notes.php?action=edit+29420 http://master.php.net/manage/user-notes.php?action=delete+29420 http://master.php.net/manage/user-notes.php?action=reject+29420

« previous php.notes (#43856) next »