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
shell script for reverse the string
Explain about "s" permission bit in a file?
How to find all the files modified in less than 3 days and save the record in a text file?
What are the default permissions of a file when it is created?
What does $@ mean in shell?
What is the difference between break and continue commands?
What is shell and shell script?
What is the syntax of while loop in shell scripting?
What happens when you type ls?
What is the difference between scripting and coding?
Why are shell scripts used?
What are the advantages of using shell scripts?
What language is used in terminal?
What are the advantages of shell scripting?
What is shell company all about?