Skip to content

Instantly share code, notes, and snippets.

@mhenrixon
Created March 14, 2024 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhenrixon/c0de3e7a48cc89d9827d1e1484d3cfed to your computer and use it in GitHub Desktop.
Save mhenrixon/c0de3e7a48cc89d9827d1e1484d3cfed to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Rename all files with "_component" in the name to remove "_component"
directory="app/views/components"
find "$directory" -type f -name "*_component*" | while read file; do
dir=$(dirname "$file")
name=$(basename "$file")
new_name=${name/_component/}
echo "moving $file to $dir/$new_name"
mv "$file" "$dir/$new_name"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment