note 20270 added to function.ftp-rawlist

From: Date: Thu, 28 Mar 2002 08:27:53 +0000
Subject: note 20270 added to function.ftp-rawlist
Groups: php.notes 
Request: Send a blank email to php-notes+get-28323@lists.php.net to get a copy of this message
L8 ereg mask (directory?, size, name): ereg("([-d])[rwxst-]{9}.* ([0-9]*) [a-zA-Z]+ [0-9: ]*[0-9] (.+)",$dirline,$regs); I've tried this, and it works fine if the name of the file has not a number in the first letter. for example, if I have a file named "1file.exe", it shows "file.exe"; and if I've a file named "010102.exe" it shows ".exe" only. I've improved it by doing this: if(ereg("([-d])[rwxst-]{9}.* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9]) ([0-9]{2}:[0-9]{2}) (.+)",$dirline,$regs)) { if($regs[1]=="d") $dirinfo[0] = 1; $dirinfo[1] = $regs[2]; $dirinfo[2] = $regs[3]; $dirinfo[3] = $regs[4]; $dirinfo[4] = $regs[5]; } $dirinfo[0] => is a directory? (1=yes) $dirinfo[1] => file size $dirinfo[2] => file date $dirinfo[3] => file time $dirinfo[4] => file name and now works with all filename formats! -- http://www.php.net/manual/en/function.ftp-rawlist.php http://master.php.net/manage/user-notes.php?action=edit+20270 http://master.php.net/manage/user-notes.php?action=delete+20270 http://master.php.net/manage/user-notes.php?action=reject+20270

« previous php.notes (#28323) next »