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 / manuswami

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

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between ‘ and ” quotes.

1087


How do I debug a shell script?

1020


What is a shell script? Can you name some of its advantages?

970


What is bash eval?

933


What is shell and terminal?

931


What is the default ubuntu terminal?

1051


Explain about echo command?

1045


What is the use of .sh file?

1052


What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?

998


How can we find the process name from its process id?

1125


What is a shell environment?

941


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

929


What is the use of "$#" in shell scripting?

988


What is ms powershell?

964


What is the lifespan of a variable inside a shell script?

1575