rename multiple file with same extension in Linux

I want to rename all files with .txt to .sh and wildcards don’t work to well with the rm command

here’s the trick:

for file in *.txt; do mv $file `basename $file .txt`.sh; done

One thought on “rename multiple file with same extension in Linux”

Comments are closed.