dot_testing/builds/utils/mass_rename

15 lines
238 B
Plaintext
Raw Normal View History

2024-07-22 13:47:58 -05:00
temp=$(mktemp)
ls > $temp
nvim $temp
results=$(ls | paste -d'|' - $temp)
IFS="
"
for i in $results; do
before="${i%%|*}"
after="${i#*|}"
[ "$before" != "$after" ] && mv "$before" "$after"
printf "%s -> %s\n" "$before" "$after"
done