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 / prav gir
#!/bin/sh
for filename in *$1*
do
echo "$filename"
mv -f "$filename" `echo $filename|sed "s/$1/$2/"`
done
run script like
$>scrpt1 .txt .my
Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
what is info area how many types?
What are the advantages of shell script?
What exactly is a shell?
What is meant by dos operating system?
What is the use of "$?" Sign in shell script?
What are the different types of variables used in shell script?
What are the advantages of using shell scripts?
What is scripting used for?
Is shell a scripting language?
Explain about return code?
What is shell scripting?
madhar chod unix ke 10 commands dhang se likh nahi sakta hai
How to print pid of the current shell?
How to print all array elements and their respective indexes?
What is a shell made of?