0

I've done a fair share of googling and I've found some rather complex solutions. I feel as though there must be something simpler.

Let's say I have

./1.txt
./2.txt
./more/3.txt
./more/4.txt
./more/even-more/5.txt

I'd like to rename anything .txt to .info

so

 find . -type f -name "*.txt"

.........then what?

EDIT: Pure bash would be preferred

  • @Sukminder Only works if you have perl rename, which isn't standard most places (I think it's just on Debian-derived systems?). – Tom Hunt Oct 09 '15 at 21:37

1 Answers1

0
find . -type f -name \*.txt -print0 | while read -r -d '' i; do mv -v "$i" "${i%.txt}.info"; done
Tom Hunt
  • 10,056