0

I just discovered that there are hundreds of .info files left lying around in the folder that the Backup & Migrate module uses for scheduled backups, while only 12 of these have a corresponding .gz file.

Is there a reason to keep these? Do they have any real value?

1 Answer 1

1

There doesn't appear to be any value to keeping them. To get rid of them, you can do something like this

cd /private/backup_migrate/scheduled  # where ever you keep this
for file in *.info; do gz_file=`echo "$file" | sed -e 's/.info//'`; if [[ ! -f "${gz_file}" ]]; then rm -f "${file}"; fi; done

This will preserve all *.info files that correspond to a *.gz file, and delete the rest. It appears to be an oversight on the part of the Backup & Migrate module to leave all of these lying around. (Apologies in advance to the module's maintainers if I'm mistaken on this: I do not mean to be critical, and I appreciate your work!)

If you want to wrap all this up into a quick alias or function, you can put something like this into your ~/.bashrc or ~/.zshrc or whatever:

function cleanup_backups(){ 
  pushd /<youfillinthispart>/private/backup_migrate/scheduled
  for file in *.info; do
    gz_file=`echo "$file" | sed -e 's/.info//'` 
    if [[ ! -f "${gz_file}" ]]; then
      rm -f "${file}"
    fi
  done
  pushd
}

(You'll have to make it a bit more complicated if you have subdirectories in your scheduled backups folder, but this should get you started.)

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.