note 87228 deleted from function.ftp-size by danbrown
| From: | danbrown@php.net | Date: | Tue, 25 Nov 2008 19:11:50 +0000 |
| Subject: | note 87228 deleted from function.ftp-size by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146957@lists.php.net to get a copy of this message | ||
Note Submitter: myquealer at gmail dot com
----
C_Muller, instead of getting the list of files in the parent directory and using in_array to see if
the directory exists, just do ftp_nlist on the directory you are checking the existence of. It will
return FALSE if the directory does not exist (or an array of files inside if it does).
if(ftp_nlist($ftp,$diretory)) {
#It exists
}
else{
#It does not exist (or some other error occurred)
}
or
if(! ftp_nlist($ftp,$diretory)) {
ftp_mkdir($ftp,$directory);
}