Skip to content

Instantly share code, notes, and snippets.

@Starou
Last active May 31, 2024 08:59
Show Gist options
  • Save Starou/fd0f7401cc9fad0dfeb26ec3d0c38a79 to your computer and use it in GitHub Desktop.
Save Starou/fd0f7401cc9fad0dfeb26ec3d0c38a79 to your computer and use it in GitHub Desktop.
Change the prefix of a bunch of files in Git.
#!/usr/bin/env sh
rx='(FMPLF)(.*)'
for f in FMPLF_SC_*
do
[[ "$f" =~ $rx ]]
new_f="${BASH_REMATCH[1]}_D${BASH_REMATCH[2]}"
echo "mv $f with $new_f"
git mv $f $new_f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment