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
Why do we write bin bash in shell scripts?
Explain about "s" permission bit in a file?
Write a command sequence to find the count of each word?
How to get the first line from a file using just the terminal?
What are the advantages of shell scripting?
What is shell scripting used for?
Write a command sequence to find all the files modified in less than 2 days and print the record count of each.
What is echo in shell?
write a shell script to check the failed jobs?
What is an inode block?
What is $1 in shell scripting?
What is meant by dos operating system?
How does ls command work?
Can you write a script to portray how set –x works?
What are the four fundamental components of every file system on linux?