Following on from my other question about rsync.
I am trying to understand how include/exclude directives use patterns to match against the names of files in a source directory to decide which are to be synced to a destination directory.
* does not match a directory separator, but
** can match one (zero or more of them, to be precise). Can someone explain very clearly what that means with a few rsync commands?
Here is my source dir structure:
../openwrt ../openwrt/afile.txt ../openwrt/BackupOfSettings ../openwrt/BackupOfSettings/file1.txt ../openwrt/BackupOfSettings/file2.txt ../openwrt/BackupOfSettings/file3.tar.gz ../openwrt/BackupOfPackages ../openwrt/BackupOfImages ../openwrt/BackupOfImages/anotherfile.txt ../openwrt/BackupOfImages/yetanotherfile.jpg
My source and destination directories:
This command will only sync files with extension: tar.gz from the 'BackupOfSettings' folder.
rsync -vvritn --include='BackupOfSettings/' --include='BackupOfSettings/*.tar.gz' --exclude='*' $openWrtPath $ncpPath
The above command recurses through each sub-dir of the source-dir and applies the include and exclude patterns on each file... so how would it ever "see" a directory separator?
Can someone give a scenario, maybe like the above, that demonstrates the
* failing and the
** succeeding in matching a directory separator?