I didn't read all your code, but this jumped out to me also as to Bastien for ( $i = 1; $i < count($array); $i++ ) { If you have 1 file, then you probably have "1 < 1" which does not execute even once. I definitely suggest also "$i = 0;...". -Dwight -----Original Message----- From: Chris Payne [mailto:chris@xxxxxxxxxxxx] Sent: Tuesday, February 07, 2006 12:52 AM To: php-db@xxxxxxxxxxxxx Subject: Strange rawlist behaviour Hi there everyone, Can anyone see a problem with the below code? It scans an FTP directory and adds the LAST item in that directory to the database (Being the latest item added) - however, if the directory only has 1 file in it it WON'T add anything, the system returns that the directory is empty and it's very frustrating. chris $conn_id = ftp_connect($ftp_server2); $login_result = ftp_login($conn_id, $ftp_user_name2, $ftp_user_pass2); // check connection if ((!$conn_id) || (!$login_result)) { die("FTP connection has failed !"); }; // Initiate passive mode if (ftp_pasv($conn_id, true)) { echo ""; } else { echo "Could not initiated passive mode<br><br>"; } // try to change the directory to somedir if (ftp_chdir($conn_id, "$newdir2")) { // echo "Current directory is now: " . ftp_pwd($conn_id) . "\n"; // get the file list for / $array = ftp_rawlist($conn_id, "-t"); $newdata = $contents[0]; for ( $i = 1; $i < count($array); $i++ ) { $current = $array[$i]; $structure[$i]['name'] = substr($current, 55, strlen($current) - 0); $newdatab = $structure[$i][name]; }}; // close the connection ftp_close($conn_id); }; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php