note 54750 deleted from function.ftp-rawlist by crell

From: Date: Thu, 31 Mar 2022 19:19:04 +0000
Subject: note 54750 deleted from function.ftp-rawlist by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217901@lists.php.net to get a copy of this message
Note Submitter: davidknoll at o2 dot co dot uk ---- Well, this works for me: <?php function parsed_listing($path) { $conn = ftp_connect(FTP_HOST); ftp_login($conn, FTP_USER, FTP_PASS); $list = ftp_rawlist($conn, "-a ".FTP_BASE.$path); ftp_close($conn); $i = 0; foreach ($list as $current) { $split = preg_split("[ ]", $current, 9, PREG_SPLIT_NO_EMPTY); if ($split[0] != "total") { $parsed[$i]['isdir'] = $split[0]{0} === "d"; $parsed[$i]['perms'] = $split[0]; $parsed[$i]['number'] = $split[1]; $parsed[$i]['owner'] = $split[2]; $parsed[$i]['group'] = $split[3]; $parsed[$i]['size'] = $split[4]; $parsed[$i]['month'] = $split[5]; $parsed[$i]['day'] = $split[6]; $parsed[$i]['time/year'] = $split[7]; $parsed[$i]['name'] = $split[8]; $i++; } } return $parsed; } ?>

« previous php.notes (#217901) next »