From: Vahis on
How could I rename all image files .gif .jpg .png in a whole tree to
album.jpg album.gif album.png

So the extension is kept but all images are renamed to album.

I installed Sockso after houghi's advise and it can show the cover art
if there's a file called album in the directory together with the music.

I have hundreds if not thousands of cover art files with different
names, fortunately there's always one album in a directory and most of
the time the cover art is in the same directory.


Vahis
--
"Sunrise 9:27am (EET), sunset 3:20pm (EET) at Espoo, FI (5:53 hours daylight)"
http://waxborg.servepics.com
Linux 2.6.25.20-0.5-default #1 SMP 2009-08-14 01:48:11 +0200 x86_64
11:57am up 62 days 16:58, 10 users, load average: 0.34, 0.34, 0.31
From: Vahis on
On 2010-01-01, Vahis <waxborg(a)gmail.com.invalid> wrote:
> How could I rename all image files .gif .jpg .png in a whole tree to
> album.jpg album.gif album.png
>
> So the extension is kept but all images are renamed to album.
>
> I installed Sockso after houghi's advise and it can show the cover art
> if there's a file called album in the directory together with the music.
>
> I have hundreds if not thousands of cover art files with different
> names, fortunately there's always one album in a directory and most of
> the time the cover art is in the same directory.

I think I got it:

find /music/ -name '*.jpg' |while read f; \
do mv -i "$f"
"`dirname "$f"`"/album.jpg; done

I needed to run it separately for gif.

It didn't handle everything, I gues too many spaces and stuff in
filenames.

I need to try to fix the names...

Vahis
--
"Sunrise 9:27am (EET), sunset 3:20pm (EET) at Espoo, FI (5:53 hours daylight)"
http://waxborg.servepics.com
Linux 2.6.25.20-0.5-default #1 SMP 2009-08-14 01:48:11 +0200 x86_64
1:34pm up 62 days 18:35, 11 users, load average: 0.20, 0.30, 0.33
From: rafter22 on
Vahis wrote:
> How could I rename all image files .gif .jpg .png in a whole tree to
> album.jpg album.gif album.png
>
> So the extension is kept but all images are renamed to album.
>
> I installed Sockso after houghi's advise and it can show the cover art
> if there's a file called album in the directory together with the music.
>
> I have hundreds if not thousands of cover art files with different
> names, fortunately there's always one album in a directory and most of
> the time the cover art is in the same directory.
>
>
> Vahis

krename is a very good batch renaming application for KDE.

I wish I could find something similar for Gnome.

From: Rob on
Vahis <waxborg(a)gmail.com.invalid> wrote:
> How could I rename all image files .gif .jpg .png in a whole tree to
> album.jpg album.gif album.png
>
> So the extension is kept but all images are renamed to album.

Well, what I normally do when it looks like being complex and
is a one-off job, is this:

1. put the filenames in a file.
find . -name '*.gif' -o -name '*.jpg' -o -name '*.png' -print >/tmp/f

2. get the file in a good editor, e.g. vi(m).
vi /tmp/f

3. edit the file to get the commands you want
(e.g :%s/pattern/replace/)

4. run the file
sh /tmp/f
From: Eef Hartman on
Rob <nomail(a)example.com> wrote:
> 1. put the filenames in a file.
> find . -name '*.gif' -o -name '*.jpg' -o -name '*.png' -print >/tmp/f

That doesn't work as expected: the -print will "bind" to the last
-name option and you'll only get the png files in the output.

Either (simplest) leave out the -print (it is the default anyway)
or use (escaped) parenthesese around the (or'd) expression, like
find . \( -name '*.gif' -o -name '*.jpg' -o -name '*.png' \) -print > /tmp/f

to let find know that the -print is for ALL the results
(the operation and has higher priority then or, so otherwise the
-name '*.png' -print gets evaluated first -
there's and implied "and" between any two options).

Apart from that, this is what I mostly do too for "one-off" problems
like this.
--
*******************************************************************
** Eef Hartman, Delft University of Technology, dept. SSC/ICT **
** e-mail: E.J.M.Hartman(a)tudelft.nl - phone: +31-15-278 82525 **
*******************************************************************