rename in a loop
last updated: Oct 20, 2023
I wanted to rename all *.pushup
files in a file tree to *.up
. Every time I have to do this, I figure out a loop or find/xargs invocation that works, then don't do it for long enough to forget how to do it.
Here's what I used this time (this expects globstar to be enabled):
for f in **/*.pushup; do git mv $f ${f%.pushup}.up; done
The %
inside the parameter expansion tells bash to match $f
up until it finds .pushup
. reference here