Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.