You are here

function _backup_migrate_temp_files_delete_file in Backup and Migrate 6.3

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

Delete a temporary file or folder

1 call to _backup_migrate_temp_files_delete_file()
_backup_migrate_temp_files_delete in includes/files.inc
Delete all temporary files.

File

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

Code

function _backup_migrate_temp_files_delete_file($file) {
  if (file_exists($file) && (is_writable($file) || is_link($file))) {
    if (!is_link($file) && is_dir($file) && is_readable($file) && ($handle = opendir($file))) {
      $dir = $file;
      while (FALSE !== ($file = @readdir($handle))) {
        if ($file != '..' && $file != '.') {
          _backup_migrate_temp_files_delete_file("{$dir}/{$file}");
        }
      }
      rmdir($dir);
    }
    else {
      unlink($file);
    }
  }
}