Separate file & directories in PHP -


php code used listing files , directories.

$buff = ftp_nlist($conn_id,$dir ); 

$buff array of both files & directories.

is there way 2 seperate arrays , 1 contains files , other directories.

you loop through array , check wheter item directory using function like

function ftp_is_dir($conn_id, $dir) {   if (ftp_chdir($conn_id, $dir)) {     ftp_chdir($conn_id, '..');     return true;   } else {     return false;   } } 

edit:

another possibility be

<?php function is_ftp_dir($file, $conn_id){ if(ftp_size($conn_id, $file) == '-1'){     return true; }else{     return false; } } ?> 

please note not every ftp server supports ftp_size().


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -