Novkovski Stevo Bato Novkovski Stevo Bato - 7 months ago 79
Linux Question

rsync include-from file recursion

I want to get only new or changed file list with few filters on result.
My all new or changed files are:

>f+++++++++ dsadcache.txt
>f+++++++++ root.svn
>f+++++++++ txt-file-in-root.txt
>fcsT...... wp-config.php
cd+++++++++ cache/
>f+++++++++ cache/fileincac.txt
>f+++++++++ cache/fileincache.txt
>f+++++++++ wp-content/inside.svn
>f+++++++++ wp-content/inside.txt
>f+++++++++ wp-content/object-cache.php

Final result should looks like:

>f+++++++++ txt-file-in-root.txt
>fcsT...... wp-config.php
>f+++++++++ wp-content/inside.txt

When i try to include-from file with this rules:

- *cache*
+ *.html
+ *.txt
+ *.js
+ *.php
+ *.jpg
+ *.jpeg
+ *.png
+ *.bmp
+ *.gif
+ *.tif
+ *.tiff
+ *.ico
+ *.json
+ *.xml
- *

filters work but the result is not recursive

>f+++++++++ txt-file-in-root.txt
>fcsT...... wp-config.php


>f+++++++++ wp-content/inside.txt

My command is:

rsync -nrci --include-from="file" source/ destination


In recursive mode rsync visits subdirectories from the top down, so wp-content is matched against your rules first when rsync checks the top level of your tree. As there is no inclusion pattern that matches this directory, the generic exclusion rule - * drops it.

According to rsync manpage, one way of achieving your goal is to place a + */ anywhere before the exclusion rule, so subdirectories are included during recursive operation.