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

Popularity: 13% [?]

Tags: , , ,

Leave a Reply