rsync
is a useful program of the Linux shell to perform backup copies, both local and remote
In this example, rsync
is used to copy file with specific extensions (i.e., html
, css
, jpg
, gif
and png
) from the folder with name www
to the folder with name www_backup
. The directories tree in www
is copied as is in www_backup
.
rsync -avm --include='*.html' --include='*.css' --include '*.jpg' --include '*.gif' --include '*.png' --filter 'hide,! */' www www_backup
the option –filter 'hide,! */
' means to hide
anything that is not (!
) a directory (*/
). The option –filter
has lower precedence than the –include
options, so this rule excludes all the file with the exception of the files reported in the –include
options.