Exclude selective folders with identical names in Rsync run/var/www/html/wordpress/wp-admin/uploads – (exclude) /var/www/html/wordpress/wp-content/uploads – (sync)

We recently had to run rsync excluding some identically named folders.

To explain:

/var/www/html/cms/admin/uploads - (exclude)

/var/www/html/cms/content/uploads - (sync)

Here is how we got around to getting this done

rsync -av --exclude=/admin/uploads/ /var/www/html/cms/ /var/www/html/syncfolder/ --progress

Flags:

-a: Archive mode

-v: increase verbosity

–exclude: exclude files matching PATTERN