3

I'm running the following rsync command

rsync --times -v --recursive --compress --exclude "*.svn" --rsh=/usr/bin/ssh source/folder/ user@ip:httpdocs/

which excludes *.svn files when running. My question is how do I pass it a list of file types to exclude. There are a lot of non-essential hidden files in our development copy (IDE project files and osx specific files)

I need to pass in a list of 5 or 6 file extensions for rsync to ignore.

thanks

1 Answer 1

6

Use the --exclude-from option, and specify a text file with all the patterns you want to avoid in it, like:

rsync --times -v --recursive --compress --exclude-from /tmp/filelist.txt --rsh=/usr/bin/ssh source/folder/ user@ip:httpdocs/
6
  • 6
    Or you can specify the --exclude option multiple times.
    – womble
    Nov 27, 2009 at 9:19
  • Great thanks, do I just put the file types each on a new line in /tmp/filelist.txt ?
    – neilc
    Nov 27, 2009 at 9:26
  • I like it when my command lines span both my monitors :)
    – RainyRat
    Nov 27, 2009 at 9:27
  • 1
    ...and yes, each pattern on a new line.
    – RainyRat
    Nov 27, 2009 at 9:28
  • You can say `--exclude={"/tmp","/lost+found:} etc. But NEVER use the backslash to shorten pieces of the list to fit your screen - it breaks it. Instead, use multiple excludes, like @wombie said. Or use the list in a file. RainyRat has a real point there. Not to mention having to scroll right and left if these long command lines get posted here.
    – SDsolar
    Aug 24, 2017 at 2:01

You must log in to answer this question.