[CentOS] Rsync - include only files containing matching string

Marcelo Roccasalva marcelo-centos at irrigacion.gov.ar
Wed Oct 17 12:59:31 EDT 2012


On Wed, Oct 17, 2012 at 1:35 PM, Sean Carolan <scarolan at gmail.com> wrote:
> I have a string, "2012_10_16"; let's call this $YESTERDAY
>
> How can I rsync a file tree from a remote machine to the local one,
> including *only* filenames that contain the matching string?  I've
> read the man page and googled around but can't seem to get the syntax
> right.  I either end up syncing all the files, or none of them.
> Here's how the code looks now (I will remove the dry run once it is
> working):
>
> rsync -avz --dry-run --include=*$YESTERDAY* remotehost:remotedir/
> localdir/transfer/

rsync -avz --dry-run --include=*$YESTERDAY* --exclude=*
remotehost:remotedir/ localdir/transfer/

> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



-- 
Marcelo

"¿No será acaso que ésta vida moderna está teniendo más de moderna que
de vida?" (Mafalda)


More information about the CentOS mailing list