Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

share|improve this answer
    
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. – Chase May Dec 2 '13 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. – Chase May Dec 2 '13 at 19:21

You must log in to answer this question.

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