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

for i in *
do
p=`basename $i c`
q=$p "txt"
mv $i $q
done

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I edit a .sh file?

634


Why is the use of shell script?

549


is this growing field and what is average package in this?

1880


What is the use of a shebang line?

625


What is a shell environment?

577






How important is shell scripting?

553


c program to display the information of given file similar to givan by the unix or linux command ls -l

1701


Give some situations where typing error can destroy a program?

732


How do we create command aliases in a shell?

542


What can scripts do?

671


Write a shell script to get current date, time, user name and current working directory.

647


Is shell scripting a language?

591


Is shell a part of kernel?

569


What are different types of shell?

498


What is the use of echo in shell script?

547