Re: Listing Directories of FTP
| From: | Philip Mak | Date: | Tue, 12 Dec 2000 06:48:51 +0000 |
| Subject: | Re: Listing Directories of FTP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29759@lists.php.net to get a copy of this message | ||
On Mon, 11 Dec 2000, Brandon Orther wrote:
> I am working on a script that uses ftp to browse a users files on our
> server. I only want it to show folders and not files. Is there an easy way
> to do that. Or even a hard way.
You could pipe the output of this shell command into a for loop:
find * -maxdepth 0 -type d
This will list all the directories inside *. The output will be the name
of every directory, one per line. If your system is not RedHat Linux the
syntax could be a bit different (see "man find"; -maxdepth 0 tells it not
to find directories inside directories, and -type d tells it to only match
directories and not other file types).
-Philip Mak (pmak@aaanime.net)