I would like to change file extension from *.txt file to *.text file, tried using the basename command, but I am having trouble on changing more than 1 file, I am getting a basename: too many arguments Try basename --help' for more information error.
Any suggestion?
Here's my code:
files=`ls -1 *.txt`
for x in $files
do
mv $x "`basename $files .txt`.text"
done
basename, you should have made that more explicit in your question. I have updated my answer to include that option. – jasonwryan Aug 29 '11 at 7:49ls. – afbr1201 Aug 29 '11 at 7:53