0

I am trying to use rsync to automatically backup my personal files in /home/usr to an external drive.

Of course, my /home/usr directory contains a number of hidden files (for config, etc.), such as .adobe/, .cache/, etc. I would like to exclude these from my rsync backup, as well as temporary files.

However, I also have some .files and .directories I would like to keep, like .htaccess for some websites and app config files.

I am using this rsync command:

rsync -acuvz --delete --progress --exclude-from '/home/chase/rsync/Files-excludes.txt' /home/chase/ /media/chase/Files

And the contents of Files-excludes.txt is:

/Dropbox
/Ubuntu\ One
/.*
*~

However, I'm afraid that this is going to exclude the mentioned .files and .directories, especially because the -a option recurses through subdirectories. Any insight?

1 Answer 1

0

You can use

--exclude-from file
and make an exclusion file to then describle the files and folders you want to exclude

Something like

/home/usr/.*

in the file should just exclude the . directories in /home/usr/

See more here http://articles.slicehost.com/2007/10/10/rsync-exclude-files-and-folders

2
  • Thanks for the answer, Steve. Aren't exclusions relative to the source directory? I feel like the exclude above would only exclude files in /home/usr/home/usr/.* I'll give it a try with --dry-run and see how it goes. Commented Dec 2, 2013 at 19:10
  • Yes, I did this with a dry run, and none of the . directories were excluded. I also edited my question to reflect the actual command I'm using. Commented Dec 2, 2013 at 19:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .