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: 8% [?]
Tags: apache web server, htaccess, linux, php extension
November 1st, 2011 at 9:45 am
This is faster and shorter!
rename s/.txt/.sh/ *.txt