[rsync] Exclure un pattern de la synchro par défaut - commentaires [rsync] Exclure un pattern de la synchro par défaut 2023-12-01T12:05:28Z https://blog.roxing.net/rsync-toujours-exclure-un-pattern-de-la-synchro#comment2660 2023-12-01T12:05:28Z <p>Une autre astuce pour synchroniser 2 répertoires en excluant certains fichiers et forcer la suppression des fichiers devenus obsolètes.S'appuyer sur le fichier le .gitignore pour servir de critère de filtre d'exclusion :</p> <div class="coloration_code code"><div class="spip_bash code" data-clipboard-text="rsync -vhra ~/www/local/folder serveur:/var/www/distant/folder/ --include='**.gitignore' --exclude='/.git' --filter=':- .gitignore' --delete-after"><div class="bash"><ol><li style="font-weight: normal; vertical-align:top;"><div style="">rsync <span style="color: #660033;">-vhra</span> ~<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>folder serveur:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>distant<span style="color: #000000; font-weight: bold;">/</span>folder<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--include</span>=<span style="color: #ff0000;">'**.gitignore'</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">'/.git'</span> <span style="color: #660033;">--filter</span>=<span style="color: #ff0000;">':- .gitignore'</span> <span style="color: #660033;">--delete-after</span></div></li> </ol></div></div></div>