Monday, April 16, 2007

How to rename group of files?

I am giving a simple shell script, for renaming a group of files in the current directory.In the script, i have renamed all .jsk files to .txt files.

for filename in *.jsk
do
mv $filename `basename $filename jsk`txt
done

Explanation:
1.In the for statement, i am finding out all the .jsk extension files.
2.In the mv statement, i am using basename command to strip the jsk extension.

5 comments:

BharathKumarRaju Dasararaju said...
This comment has been removed by the author.
BharathKumarRaju Dasararaju said...

nice one sujay keep posting :) :)

sunitha vishnu said...


This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharng this information,this is useful to me...
Android training in chennai
Ios training in chennai

Sharon Sandy said...




Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..please sharing like this information......
Web Design Development Company
Mobile App Development Company

Reena raj said...


Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
Web Design Company
Web Development Company