note 45359 deleted from function.ftp-rawlist by crell

From: Date: Thu, 31 Mar 2022 19:29:54 +0000
Subject: note 45359 deleted from function.ftp-rawlist by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217903@lists.php.net to get a copy of this message
Note Submitter: guru at virusas dot lt ---- Lets say only one of these scripts can accept filenames with spaces, but that script doesn't return all info that we may need, so i have modified a little bit one of my script and added some more regexp from here: <? $buff = ftp_rawlist($cid,"/"); foreach ($buff as $file) { if(ereg("([-d][rwxst-]+).* ([0-9]) ([a-zA-Z0-9]+).* ([a-zA-Z0-9]+).* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9]) ([0-9]{2}:[0-9]{2}) (.+)",$file,$regs)) { if(substr($regs[1],0,1)=="d") $isdir=1; else $isdir=0; $tmp_array['line']=$regs[0]; $tmp_array['isdir']=$isdir; $tmp_array['rights']=$regs[1]; $tmp_array['number']=$regs[2]; $tmp_array['user']=$regs[3]; $tmp_array['group']=$regs[4]; $tmp_array['size']=$regs[5]; $tmp_array['date']=date("m-d",strtotime($regs[6])); $tmp_array['time']=$regs[7]; $tmp_array['name']=$regs[8]; } $dir_list[]=$tmp_array; } ?> The result is smth like that: 8 => array 'line' => '-rw-r--r-- 1 guru users 4 Sep 3 09:41 testas testas testas.txt' 'isdir' => 0 'rights' => '-rw-r--r--' 'number' => '1' 'user' => 'guru' 'group' => 'users' 'size' => '4' 'date' => '09-03' 'time' => '09:41' 'name' => 'testas testas testas.txt' 9 => array 'line' => 'drwxr-xr-x 3 guru users 4096 Aug 20 08:54 upload' 'isdir' => 1 'rights' => 'drwxr-xr-x' 'number' => '3' 'user' => 'guru' 'group' => 'users' 'size' => '4096' 'date' => '08-20' 'time' => '08:54' 'name' => 'upload' Home this will help someone

« previous php.notes (#217903) next »