rsync exclude files based on filesize

Matthias Schniedermeyer ms at
Wed Sep 30 07:17:16 MDT 2009

On 30.09.2009 08:00, Rahul Nabar wrote:
> On Wed, Sep 30, 2009 at 4:41 AM, Paul Slootman <paul+rsync at> wrote:
> > On Tue 29 Sep 2009, Rahul Nabar wrote:
> >
> >> Is there a way to set rsync excludes by filesize? I already do
> >
> > Did you look in the manpage?
> >
> > "man rsync", search for "size" and the 5th hit describes it.
> Thanks Paul! I deserve a RTFM. Had done that on rsnapshot but missed
> out on doing it on rsync.

The only problem you have is that you can't logically combine it in one 
go. The size-limit won't be limited to .nc-files, but ALL files.

So you have to make 2 runs.
- One for anything but .nc-files
- One for only .nc-files with the size-limit
- One for anything smaller than size-limit
- One for anything bigger than size-limit and excluding .nc-files


In case you use "--delete-excluded" you are opting for a truckload of 
fun. But if i understand the man-page correctly the later example MAY 
have less of a problem, as the "--delete-excluded" says that it only 
applies to exclude/filters. --min-size/--max-size, according to 
man-page, aren't filelist-filters but transfer-filters. So 
--delete-excluded shouldn't apply.

Without --delete-excluded you should be in the clear.

Bis denn

Real Programmers consider "what you see is what you get" to be just as 
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated, 
cryptic, powerful, unforgiving, dangerous.

More information about the rsync mailing list