G'Day,
J'utilise rsync pour synchroniser récursivement une arborescence de dossiers distants qui ressemble à ceci:
/folderA/a1/cache /folderA/a1/cache/A1 /folderA/a1/cache/A2 /folderA/a1/somefolder /folderA/a1/someotherfolder /folderA/a2/somefolder/cache /folderB/cache/ /folderB/b1/somefolder/cache /folderB/b1/somefolder/yetanotherfolder/cache /folderB/b1/somefolder/yetanotherfolder/cache/B1 /folderB/b1/somefolder/yetanotherfolder/cache/B2
Je ne sais pas à quoi ressemblera l'arborescence des dossiers et cela changera avec le time. Donc, ce que je veux pouvoir faire est récursivement rsync mais exclure le dossier "cache" et tous les sous-dossiers qu'il contient afin que j'arrive finalement à synchroniser:
/folderA/a1 /folderA/a1/somefolder /folderA/a1/someotherfolder /folderA/a2/somefolder /folderB/ /folderB/b1/somefolder /folderB/b1/somefolder/yetanotherfolder/
Aucune suggestion?
Vous voulez le drapeau --exclude
. Par exemple, un rsync local:
rsync -a --exclude cache/ src_folder/ target_folder/
C'est aussi simple que cette règle d'exclusion correspondra à un directory nommé "cache" n'importe où dans votre tree.
Pour plus d'informations, searchz les sections "–exclude" et "FILTER RULES" sur la page man de rsync: