rsync¶
see also my mess over at ssh, scp, rsync
only include specific file (pattern)¶
I only want to sync files which match a specific name and exclude everything else.
- Important: the include/exclude lists are case sensitive.
In this case, I want to sync all files with foo and bar in the name, so it'd match the files foobar and Superduper.jpg
or with individual include
arguments:
rsync -avP --include='*.yaml' --include='*.yml' --include='.env' --exclude='.git' --exclude='*' ~/source/ ~/dest/
include / exclude from file pattern¶
example include_patterns.txt
file to specify which files should be included
use it in rsync like this:
this is a basic example, it's worth checking out the filter rules of rsync's man page
do not copy empty directories¶
-m
or --prune-empty-dirs
: Prevents rsync from creating empty directories in the destination.
delete files on the source¶
you might want to run this first with -n
for a dry run