note 78258 rejected from function.ftp-nlist by ezyang
| From: | ezyang@php.net | Date: | Thu, 04 Oct 2007 22:42:55 +0000 |
| Subject: | note 78258 rejected from function.ftp-nlist by ezyang | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-131096@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at weltvolk dot de
----
How do I get the filelist in alphabetical order with all directories at the top?
<?php
if (ftp_chdir($ftp_connect, $dir)) {
$ftp_nlist = ftp_nlist($ftp_connect, ".");
sort($ftp_nlist);
foreach ($ftp_nlist as $v) {
if (ftp_size($ftp_connect, $v) == -1) {
echo "[ " . $v . " ]<br />\n";
}
}
foreach ($ftp_nlist as $v) {
if (!(ftp_size($ftp_connect, $v) == -1)) {
echo "" . $v . "<br />\n";
}
}
}
?>