list_files() public method

FTP List files in the specified directory
public list_files ( string $path = '.' ) : array
$path string
return array
Example #1
0
     if (!file_exists('../example/' . $filelist[$i])) {
         $logmessage = "NOTEXIST: 文件 " . $filelist[$i] . " 不存在。\n<br/>";
         echo $logmessage;
         $example->add_log($logmessage);
         unset($filelist[$i]);
         if (count($filelist)) {
             exit("WARING: 没有上传任何文件!");
         }
     }
 }
 //处理远程目录旧文件
 for ($i = 0; $i < count($filelist); $i++) {
     echo str_pad('', 4096);
     ob_flush();
     flush();
     if ($example->list_files($filelist[$i] . '.bak')) {
         $example->delete_file($filelist[$i] . '.bak');
         $logmessage = "MESSAGE: 远程文件 " . $filelist[$i] . '.bak' . " 删除成功!\n<br/>";
         echo $logmessage;
         $example->add_log($logmessage);
     } else {
         $logmessage = "DELETE:  没有 " . $filelist[$i] . '.bak' . " 或删除失败! \n<br/>";
         $example->add_log($logmessage);
     }
     if ($example->list_files($filelist[$i])) {
         if (!$example->rename($filelist[$i], $filelist[$i] . '.bak')) {
             $logmessage = "RENAME : 文件 " . $filelist[$i] . "   重命名失败!\n<br/>";
             $example->add_log($logmessage);
             unset($filelist[$i]);
         } else {
             //将备份的文件记入日志,上线时统一删除