[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Renommage en masse



Bruno Berteau a écrit :
find . -name '*Th*.*' -type f -exec rename 's/Th/rt/' {} \;

Dans ce cas, pourquoi ne pas mettre directement
rename 's/Th/rt/' *Th*.*

rename agira sur tous les types de fichiers (liens, pipe,
répertoires,...) s'il correspondent à la recherche alors que find ne
renomera que les fichiers réguliers (option -type f)

Attention quand même aux répertoires, car si le pattern correspond aussi à un répertoire, le rename va planter avec le find.

Exemple:
avec
unrepTOTO/unfichierTOTO
rename 's/TOTO/titi/' *TOTO*

renomme bien unrepTOTO/unfichierTOTO en unreptiti/unfichiertiti

mais
find -type f -name '*TOTO*' -exec rename 's/TOTO/titi/' {} \;
renvoie "Can't rename ./unrepTOTO/unfichierTOTO /unreptiti/unfichierTOTO: Aucun fichier ou répertoire de ce type" car le rep unreptiti n'existe pas.

Daniel



Reply to: