Latest web development tutorials

PHP ftp_rawlist () function

PHP FTP Reference Complete PHP FTP Reference

Definition and Usage

ftp_rawlist () function returns the detailed list of files in a directory on the FTP server.

grammar

ftp_rawlist(ftp_connection,dir,recursive)

参数 描述
ftp_connection 必需。规定要使用的 FTP 连接。
dir 必需。规定目录。请使用 "." 来规定当前目录。
recursive 可选。默认情况下,该函数向服务器发送 "LIST" 命令。然而,如果 recursive 参数设置为 TRUE,则发送 "LIST -R" 命令。


Tips and Notes

Note: This function returns an array of response from the server.It does not perform parsing.


Examples

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");

print_r (ftp_rawlist($conn,"."));

ftp_close($conn);
?>

The code above will output:

Array
(
[0] => dr--r--r-- 1 user group 0 Feb 15 13:02 .
[1] => dr--r--r-- 1 user group 0 Feb 15 13:02 ..
[2] => drw-rw-rw- 1 user group 0 Jan 03 08:33 images
[3] => -rw-rw-rw- 1 user group 160 Feb 16 13:54 test.php
[4] => -rw-rw-rw- 1 user group 20 Feb 14 12:22 test.txt
)


PHP FTP Reference Complete PHP FTP Reference