Bash - Find several specific folders in a directory and its sbdirectories and rename these specific folders Bash - Find several specific folders in a directory and its sbdirectories and rename these specific folders shell shell

Bash - Find several specific folders in a directory and its sbdirectories and rename these specific folders


You can do this with oneliner:

find . -name "a" -type d -execdir rename 's/a/b/' {} \;

The parameter to name might be regex.With -type d it will find all directories.-execdir changes to a matching item's directory and then executes the rename command, passing the filename of the item at hand as an argument ({}).