Renaming Multiple Files on macOS Terminal [duplicate]
You can do this in bash natively by looping over the files beginning apple
and renaming each one in turn using bash parameter expansion
$ for f in apple*; do mv "$f" "${f/apple/pear}"; done
The for f in apple*
finds all files matching the wildcard. Each filename is then assigned to the variable f
For each assignment to f
bash calls the command mv
to move (rename) the file from it's existing name to one where apple
is replaced by pear
You could also install rename
using a package manager like Homebrew and call
rename -e 's/apple/pear/' apple*