User Tools

Site Tools

Return to Home page


rsync is a useful program of the Linux shell to perform backup copies, both local and remote

Copy of specific file types

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.

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at]

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url:
/web/htdocs/ · Last modified: 2020/11/26 23:18 (external edit)