Skip to content

Instantly share code, notes, and snippets.

@douglascayers
Created August 18, 2019 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save douglascayers/a41b8fa8ca927ea11ce743096290d3d0 to your computer and use it in GitHub Desktop.
Save douglascayers/a41b8fa8ca927ea11ce743096290d3d0 to your computer and use it in GitHub Desktop.
Rename files in all subdirectories.
# Finds all files in the current directory and subdirectories
# whose filenames match the expression "*.js" (ends with .js)
# then renames the files, changing their extension to ".ts".
# https://stackoverflow.com/questions/7450818/rename-all-files-in-directory-from-filename-h-to-filename-half
for file in $(find . -type f -name "*.js")
do
mv "$file" "${file/.js/.ts}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment