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 / geichel
#!/bin/bash
for x in $(find $1 -name '*.txt' -type f )
do
OUT=$(echo $x | sed -e "s/\.txt$/.my/")
mv $x $OUT
done
exit 0;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain how you Automate your application using Shell scripting.
What are the various stages of a linux process it passes through?
What language is bash?
What is computer cli?
What is wc in shell script?
What is the use of "$#" in shell scripting?
Print the 10th line without using tail and head command.
Is scripting and coding the same thing?
Can you write a script to portray how set –x works?
What is difference between shell and bash scripting?
Suppose you execute a command using exec, what will be the status of your current process in the shell?
How do I run a script from command prompt?
How to use arguments in a script?
What is shell variable?
What is the difference between grep and egrep?