Re: Renaming groups of files modifying only a character



On 2006-07-11, Shaman wrote:
How could I modify groups of files which are defined by a progressive
number, like:

100**.example

varying just a char:

101**.example

Some systems have a rename command; for those that don't:

n=100
for file in 100*.example
do
mv -i -- "$file" "$n${file#100}"
n=$(( $n + 1 ))
done

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
.



Relevant Pages