Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to rename all the files in a folder having specific
extension?
Example: I have some files with extension (.txt) in a folder
name 'Test'. I have to rename all the .txt files in a test
and its subdirectories to .my extension.

Answer Posted / venugopal adep

for file in `ls *.txt`; do new_file=`echo $file | sed
's/txt/my/g'`; mv $file $new_file; done

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is the use of shell script?

963


What is a shell in operating system?

1084


Explain about login shell?

1103


I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.

1018


How to write a function?

1016


How to print pid of the current shell?

980


What is the difference between grep and egrep?

1115


Is shell scripting difficult?

930


What is the fastest scripting language?

985


What is a batch file used for?

1063


What does echo $0 do?

948


Which shell is the best?

976


How do we delete all blank lines in a file?

1090


What does $$ mean in shell script?

1034


Is shell scripting a language?

1018