Recursively rename or change the suffix on MacOS

Photo by Adi Goldstein on Unsplash

Here is how to recursively rename a bunch of files on mac

First it finds all the files with the .md extension and then renames them to .mdx while substituting the filename found in the glob.

find ./ -type f -name "*.md" -exec sh -c 'mv "$0" "${0%.md}.mdx"' {} \;