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 the use of "$?" Sign in shell script?
What are filters explain sort with all the options available?
What is shell company all about?
How to use arguments in a script?
Write down the syntax for all the loops in shell scripting.
Explain about debugging?
What is web script?
What is inside a seashell?
What is the default shell of solaris?
Is shell scripting a language?
What is bash shell command?
What can scripts do?
What is the command to find out today's date?
How do we create command aliases in a shell?
What is shift command in shell script?