[Résolu] Exclude et RSYNC

Bonjour toout le monde,

Avec rsync, ne peut-on pas exclure des répèrtoires à sauvegarder ? si oui, de quelle façon ?
voici mon script:

#! /bin/sh #Dossier de destination stockage="/home/chris/Save" #dossier perso à sauvegardés perso="/home/chris" rsync -acuzC --delete --exclude ".*" $perso $stockage/chris_backup exit

J’aimerai exclure par exemple un dossier nommé “Photos”

Merci de votre aide

Comme ceci?

#! /bin/sh #Dossier de destination stockage="/home/chris/Save" #dossier perso à sauvegardés perso="/home/chris" rsync -acuzC --delete --exclude "chris/photos" $perso $stockage/chris_backup exit

Comme tu as défini ta source (/home/chris) sans / final, il va te créer un répertoire /home/chris/Save/chris/ Si tu veux que rsync ne copie que le contenu de /home/chris/ sans le répertoire père (chris) tu dois mettre ta source comme ceci: /home/chris/

Du coup ton exclude devient: --exclude “photos/”

Ça a l’air confus mais finalement assez logique.

[code]A trailing slash on the source changes this behavior to avoid creating an additional directory level at
the destination. You can think of a trailing / on a source as meaning “copy the contents of this direc‐
tory” as opposed to “copy the directory by name”, but in both cases the attributes of the containing
directory are transferred to the containing directory on the destination. In other words, each of the
following commands copies the files in the same way, including their setting of the attributes of
/dest/foo:

          rsync -av /src/foo /dest
          rsync -av /src/foo/ /dest/foo[/code]

Astuce: rajoute l’option --dry-run pour faire des essais “à blanc”.

Nickel…