Hi,
i want to write a script to change the extension of a file to new extension.
i already wrote a script which i can change all the files in one folder, but the thing that i have more then 300 folders, and i want to go to each folder and run the script.
is there a way, to run the script, so it can go to each folder and change the extension.
for example, the main folder is "main" located in /root/home/main
in main folder, i have the folders: f1, f2, f3, ..., f100.
the files located in "f1, f2, ..." are like this: "1.txt;1", "2.tta;1", etc,,
the extension is ".txt;1", "tta;1".
so, my script is:
Code:
#!/bin/bash
for name in `ls -1 | grep -v $0`
do
file_ext_1=`echo $name |cut -d';' -f1`
mv $name $file_ext_1
done
how can i change this script to start by itself going to each folder and change the ext, but i just need to to do this only on "main" and its folders.
Thanks in advance.
regards