Options:
1) you can use ftp_rawlist instead of ftp_nlist to get a complete list for the file / directory, which should indicate if it is a directory. However, the format of this list will depend on the ftp server operating system. For example, on a unix / linux system, the source list might look something like this:
drwxrwxr-x 3 jm72 jm72 4096 Nov 2 16:39 myDir -rw-rw-r-- 1 jm72 jm72 257 Nov 2 16:39 myFile
where the "d" in the first column will tell you the directory. Not sure how it will look on a Windows server.
2) for each returned file name, try writing it to a CD. If you can, this is a directory!
if (ftp_chdir($conn_id, substr($contents[$i],1)) {
Jacob Mattison
source share