How to Exclude Files from a Backup?

Avatar
  • updated
  • Answered

I'd like to back up my home directory but exclude a couple of massive video files which I don't need to back up. Otherwise my back up file will be unnecessarily big and take much time to download. Is this possible?

Avatar
JacobIMH
Hello, and thanks for the great question! If you'd like to backup your account, but exclude certain files or directories, this can be done with a cpbackup-exclude.conf file placed inside your home directory such as /home/userna5. It's important to note, that this will only exclude files when you are doing a Full Backup. Either from the Backups tool under Files, and clicking on Download or Generate a Full Website Backup. Or when using the Backup Wizard, and clicking on Full Backup -->, and then Generate Backup. If you you just click on Home Directory to download your /home/userna5/public_html/ files, the exclude file will be ignored and your large movie files will still download. Also keep in mind that as this would be a Full Backup, you probably want to exclude some other directories such as your mail if you're storing a lot on the server. That way you don't have excessive redundant backups on your account, or have to spend longer times downloading files to your computer. So in your case, I'd probably recommend a cpbackup-exclude.conf file something along the lines of this:
access-logs/*
.*
mail/*
public_ftp/*
tmp/*
/public_html/videos/large_vid001.avi
/public_html/videos/large_vid002.avi
The files I highlighted in red would be how you'd want to exclude them one by one. Or as you can see above those, if you want to exclude all the files from a directory, use an asterisk * after the directory. If you have a very large account though, you'd more than likely instead want to select certain files specifically to archive with a cronjob. Then connect via FTP to your account to retrieve that backup for safe keeping. I'll try to update this question with some guides, as it seem we don't have any written in our support center regarding this. Thanks again for the question and let us know if you had any others! - Jacob