Search code examples
bashshellterminalfile-renamebatch-rename

Batch rename default.html to index.html in Terminal


How do I batch rename these file names in OS X Terminal?

default.html
about/default.html
gallery/team/default.html
...

To:

index.html
about/index.html
gallery/team/index.html
..

Solution

  • Try this :

    find . -name 'default.html' -execdir mv '{}' index.html \;
    

    With -execdir the file is renamed in the dir where it was found.