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:

  1. This comment has been removed by the author.

    ReplyDelete
  2. nice one sujay keep posting :) :)

    ReplyDelete
  3. 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

    ReplyDelete
  4. 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

    ReplyDelete