You are here

function _backup_migrate_move_files in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.3 includes/files.inc \_backup_migrate_move_files()
  2. 6.3 includes/files.inc \_backup_migrate_move_files()

Move files recursively.

2 calls to _backup_migrate_move_files()
backup_migrate_destination_filesource::_restore_from_file_php in includes/sources.filesource.inc
Restore to this source.
backup_migrate_files_destination_archivesource::_restore_from_file_php in includes/sources.archivesource.inc
Restores to this source.

File

includes/files.inc, line 76
General file handling code for Backup and Migrate.

Code

function _backup_migrate_move_files($from, $to) {
  if (is_readable($from)) {
    if (is_dir($from) && is_readable($from) && ($handle = opendir($from))) {
      if (!file_exists($to)) {
        mkdir($to);
      }
      while (FALSE !== ($file = @readdir($handle))) {
        if ($file != '..' && $file != '.') {
          _backup_migrate_move_files("{$from}/{$file}", "{$to}/{$file}");
        }
      }
      closedir($handle);
    }
    else {
      rename($from, $to);
    }
  }
  return FALSE;
}