Hi guys,
I have been trying to display all folders on a remote FTP server but I could not find a solution. I tried the raw list function but the problem comes from the fact that it reads only files and as soon as I created a folder my script got stuck. Do you have any ideas of how to do that because I could not find an exact function for that task.
FTP list folders
Moderator: General Moderators
Reply
Thank you for the fast reply, feyd. The test code I have (Actually I have a class which has a function whose fubctionality is sinilkar to that sample) is a sample from http://www.php.net. It is used to print files and folders on the remote host but when there is a direcory it gets stuck.
This is the code:
This is the code:
Code: Select all
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// get the file list for /
$buff = ftp_rawlist($conn_id, '/');
// close the connection
ftp_close($conn_id);
// output the buffer
var_dump($buff);
?>ftp_nlist() example in the manual page shows the function returning folder names.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.