LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rename several files in bash or python (https://www.linuxquestions.org/questions/linux-newbie-8/rename-several-files-in-bash-or-python-542644/)

xeon123 04-02-2007 09:00 AM

rename several files in bash or python
 
Hi,

i would like to build a bash script or a python program that list a directory structure and, for all the files that it find, removes the extension java,v to java. How i do that?

Regards,
Pedro

xeon123 04-02-2007 09:01 AM

I think i found it.

for file in *.txt; do mv $file `echo $file | sed 's/\(.*\.\)txt/\1TXT/'`; done

xeon123 04-02-2007 09:08 AM

But, i've another question.

If i want to run this script inside each directory, how should i do it?

thanks


All times are GMT -5. The time now is 01:06 AM.