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 about return code?
What is shell environment?
How do I set bash as default shell mac?
How will you emulate wc –l using awk?
What is bash shell command?
State the advantages of shell scripting?
What does $$ mean in shell script?
What is @echo off?
What is wc in shell script?
What are zombie processes?
What command needs to be used to take the backup?
Explore about environment variables?
What is shell prompt?
What does $1 mean in bash?
How can you get the value of pi till a 100 decimal places?