function drupal_ftp_file_list in Backup and Migrate 7.2
Same name and namespace in other branches
- 8.2 includes/destinations.ftp.inc \drupal_ftp_file_list()
- 8.3 includes/destinations.ftp.inc \drupal_ftp_file_list()
- 6.3 includes/destinations.ftp.inc \drupal_ftp_file_list()
- 6.2 includes/destinations.ftp.inc \drupal_ftp_file_list()
- 7.3 includes/destinations.ftp.inc \drupal_ftp_file_list()
The drupal_ftp_file_list Function This function will change into the $directory folder and get a list of files and directories contained in that folder. This function still needs a lot of work, but should work in most cases.
1 call to drupal_ftp_file_list()
- backup_migrate_destination_ftp::_list_files in includes/
destinations.ftp.inc - List all the available files in the given destination with their destination specific id.
File
- includes/
destinations.ftp.inc, line 293 - Functions to handle the FTP backup destination.
Code
function drupal_ftp_file_list($directory, &$ftp) {
// This function will attempt to change into the specified
// directory and retrieve a list of files as an associative
// array. This list will include file name, size and date last modified
$file_array = array();
// Can we switch to the desired directory?
if (!drupal_ftp_change_directory($directory, $ftp)) {
return FALSE;
}
// We are in the directory, let's retrieve a list of files
// This is slower than parsing the raw return values, but it is faster.
$file_list = ftp_nlist($ftp->__conn, $directory);
// Save the list of files
if (@is_array($file_list)) {
// Interate through the array
foreach ($file_list as $file) {
$file_array[] = array(
'filename' => $file,
'filesize' => ftp_size($ftp->__conn, $directory . "/" . $file),
'filetime' => ftp_mdtm($ftp->__conn, $directory . "/" . $file),
);
}
}
sort($file_array);
return $file_array;
}