1

I am setting up rsyncrypto to create a backup of my user directory. I read that to exclude directories I need to exclude with find and pipe to rsyncrypto.

I am trying to exclude all .svn directories from getting encrypted and synced.

Here is the find command I'm using. I don't see any .svn directories in the output:


find ~/Documents -type d ( -name .svn ) -prune -o -print


But when I pipe the output to rsyncrypto I see lots of .svn directories getting encrypted.


find ~/Documents -type d ( -name .svn ) -prune -o -print | rsyncrypto -vc --trim=3 --filelist - /tmp/Documents/ Documents.keys backup.crt


Can someone help me rewrite the command to exclude from rsyncrypto any files/folders that have .svn in their path?

2
  • I'm trying to exclude more than one directory too: find ~/Documents -type d ( -name .svn -o -name .DS_Store ) -prune -o -print
    – Richard
    Commented Aug 21, 2010 at 20:02
  • Looks like the --filestype directive is causing the trouble because it recurses any directory. Revising this then, can someone help me change my find so that it gets all files excluding those with .svn anywhere in their path?
    – Richard
    Commented Aug 21, 2010 at 20:25

1 Answer 1

1

Your original find command prints all directories except for those under a .svn directory, in particular it prints ~/Documents. Experimentally, rsynccrypto recurses into all existing directories in a filelist, even though (like you, I think) I understand the documentation to say that it should only recurse into directories with a / appended.

So you need to print only files that are not directories. This means you must restrict -print with -type f (to back up only regular files) or ! -type d (to back up all non-directories, including symbolic links).

find ~/Documents -type d \( -name .svn -o -name .DS_Store \) -prune \
              -o \! -type d -print

Note that this won't back up the modification time and ownership of directories, or empty directories. This will include empty directories as well:

find ~/Documents -type d \( -name .svn -o -name .DS_Store \) -prune \
              -o \! -type d -print \
              -o -type d -empty -print
1
  • Thanks Giles, that works perfectly. I even added a condition to exclude a few files too. Teach a man to fish...
    – Richard
    Commented Aug 21, 2010 at 23:16

You must log in to answer this question.

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