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
How to set an array in linux?
What are the advantages of shell script?
How do I run a shell script on a mac?
Explain about echo command?
is this growing field and what is average package in this?
How will you emulate wc –l using awk?
Calculate a real number calculation directly from the terminal and not any shell script.
What is the syntax of "nested if statement" in shell scripting?
Why is the use of shell script?
Explain about gui scripting?
What is the best scripting language?
Is cmd a shell?
How will you connect to a database server from linux?
Write a command sequence to find all the files modified in less than 2 days and print the record count of each.
How to get the 3rd element/column from each line from a file?