Page 1 of 1

How to rename several files in different locations

Posted: Wed Mar 25, 2020 5:55 am
by MechWright
Hi guys&gals,

I need to rename several files in different locations, for example /folder1/Test -> /folder1/Test.txt , /folder2/Test -> /folder2/Test.txt and so on, that is
the names are standard but the folders are not. The files to be renamed can be easily found using my favourite bash command FIND, but then what?

Code: Select all

find . -name "Test" -exec mv {} ??

Re: How to rename several files in different locations

Posted: Wed Mar 25, 2020 12:19 pm
by rene
For example, find -name Test -exec mv {} {}.txt \;