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 does sh mean?
wats the deinitions for shell utility and filter?
c program the catches the ctrl-c(SIGINT) Signal for the first time and prints a output rather and exit on pressing Ctrl-C again
How do you know which shell I am using?
What is the use of a shebang line?
Is shell scripting a language?
What does $0 mean in shell script?
What does echo $0 do?
How do you debug a script?
How do I set bash as default shell mac?
How do you find out What is your shell?
Write down the syntax of "for " loop
How do I start a shell script?
How do you create a shortcut in linux?
How will you print the login names of all users on a system?