Automated Backup with exception of one directory?

Is there a way to make automated backups with the user data except one folder of one user? Im asking because the size of the backup would be huge, thats why I dont want to Backup this one big folder.

Anyone an idea?

Operatingsystem? Linux or Windows?

linux. nextcloudpi (still a linux beginner)

Maybe it is a good start to read this:

I do a lot of different things with it, give it a try.

ok. I read a bit but then I woundered, if I maybe gave you the wrong answer

I have a nextcloudpi server running and would like to backup on to MacOS or Windows.

Or would you recommend to make backups with a second RaspberryPi(linux)?

You can use TAR to put backup platform independent in archive:

tar -cvpzf backup.tar.gz --exclude=FolderToExclude --one-file-system folderToBackup

Or use RSYNC as it listed above with same key --exclude=FolderToExclude.

Or you can even combine and do rsync into archive (with remote authentication via SSH Key):

Or use restic:

it works, but I have following questions:

  1. How can I set it up to dont compress it? (just delete the ending .gz?)
  2. How can I automate it to run this command every x Days and then automatically change the name to the current date of the backup?

with TAR, just do not use key


z - compress the backup file with ‘gzip’ to make it smaller.

and ending .gz, e.g.:

tar -cvpf backup.tar --exclude=FolderToExclude --one-file-system folderToBackup

Use cron job to run command periodically and change command to something like this to have date in file name.

tar -cvpf backup_$(date +"%Y-%m-%d").tar --exclude=FolderToExclude --one-file-system folderToBackup

It Works.

Please notice to add a "backslash " before typing a “%” in a crontab.

This would look like:

tar -cpvf backup_$(date +"\%Y-\%m-\%d").tar ........
1 Like