0

I've been tasked to update a few of our sites and so, before doing so, I have to zip the public_html folder so I have a backup.

Problem is, public_html has a bunch of other ZIPs that are older backups that I don't want to delete in case my backup fails or for some other reason, we need to go back 2-3 backups.

But, since they are there and get caught in every backup, the backup file grows and grows because it contains basically every single previous backup within it.

So is there a way to tweak the zip command line call so it gets all files, except any .zip or .gzip file it finds?

Fredy31
  • 103
  • 3

1 Answers1

3

The quick answer is to exclude the existing zip files:

zip -r foo /path/to/public_html -x '*.zip' -x '*.gzip'

Add/remove the -x options to match your existing naming convention for zip and gzip files.

The long-term answer would be to store the backup files outside the public_html folder so that you don't keep catching them in the backups.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255