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.

4 comments:

Raaaj said...
This comment has been removed by the author.
Raaaj said...

nice one sujay keep posting :) :)

DedicatedHosting4u said...

Nice post i really like these types of the article wherever you'll be able to get plenty of data with bit example keep writing like this and lots of folks select your content.

DedicatedHosting4u.com

PromoBuddy said...

Your post is just outstanding! thanks for such a post,its really going great and great work!
Promobuddy is one of the best Digital Marketing Company in Ghaziabad
experts in India He can solve all problems related SEO Services,
SMM Services,
PPC Services,
SEM Services,
Best Web Designing Company in India

for more information Visit Our Site We Are happy to help you!
Digital Marketing Company in Ghaziabad