Author Topic: Newbie Question: Rename mp3  (Read 6090 times)

dino.conte

  • Newbie
  • *
  • Posts: 7
Newbie Question: Rename mp3
« on: May 17, 2013, 11:33:51 PM »
Is there a way to rename mp3 files, including generation of folders from the Tag with exiftool (i use Linux)?

Example: The file "imagine,mp3" has the Tag "Artist: John Lennon", Album "Gimme Some Truth", Title "Imagine", Track "15" and is saved in /downloads/imagine.mp3

Ich will get the output:  /John Lennon/Gimme Some Truth/15 - Imagine.mp3

I have found nothing about this in the documentation ...

Many Greetings,
Dino


dino.conte

  • Newbie
  • *
  • Posts: 7
Re: Newbie Question: Rename mp3
« Reply #1 on: May 18, 2013, 03:43:38 AM »
I found this:

exiftool -ext MP3 '-Directory<Artist' .

Alternatively, for recursive processing:
exiftool -r -ext MP3 '-Directory<Artist' .

And - it works beautifully!

But, how do I get a directory structure such as /Artist/Album/.. ??

dino.conte

  • Newbie
  • *
  • Posts: 7
Re: Newbie Question: Rename mp3
« Reply #2 on: May 18, 2013, 04:08:33 AM »
All questions answered by me  ;D

I forgot the "$".

So everything is working fine:

exiftool -ext MP3 '-Directory<$Artist/$Album' .

Respectively, for recursive cycle:
exiftool -r -ext MP3 '-Directory<$Artist/$Album' .

dino.conte

  • Newbie
  • *
  • Posts: 7
Re: Newbie Question: Rename mp3
« Reply #3 on: May 18, 2013, 06:15:15 AM »
Regardless of the above, how can I use multiple Tags for the renaming of the file name?

I.E. i have "lennon.mp3", the Tags are "Artist=Lennon", "Title="Imagine", "Track=02".
How can i rename the file to "02 - Lennon - Imagine.mp3" (in the same directory)?

exiftool '-filename<$Track$Artist$Title.%e' lennon.mp3 is not properly ...  :'(

with one Tag it Works great:

exiftool '-filename<$Title.%e' lennon.mp3  :D

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: Newbie Question: Rename mp3
« Reply #4 on: May 18, 2013, 06:44:37 AM »
Hi Dino,

exiftool '-filename<$Track$Artist$Title.%e' lennon.mp3 is not properly ...  :'(

This should work, provided the Track, Artist and Title tags exist and don't contain illegal characters.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dino.conte

  • Newbie
  • *
  • Posts: 7
Re: Newbie Question: Rename mp3
« Reply #5 on: May 18, 2013, 08:13:18 AM »
Hi Phil,

and thanks for your answer!

It works, but move the renamend file in a new created folder, can i have the file at the same place?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: Newbie Question: Rename mp3
« Reply #6 on: May 18, 2013, 08:18:59 AM »
If the file name doesn't contain a slash ("/"), then it won't be moved to another directory.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dino.conte

  • Newbie
  • *
  • Posts: 7
Re: Newbie Question: Rename mp3
« Reply #7 on: May 18, 2013, 08:41:54 AM »
The Tag "Track" contains als Slash, so i must live with it  ;)

Thank's for these great tool!!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: Newbie Question: Rename mp3
« Reply #8 on: May 18, 2013, 08:22:44 PM »
Hi Dino,

You don't have to live with anything you don't want to.

Do this in your expression to remove the slash: ${track;}

The semicolon invokes the advanced formatting feature, and without an expression the default is to remove / \ ? * : | < and >.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dino.conte

  • Newbie
  • *
  • Posts: 7
Re: Newbie Question: Rename mp3
« Reply #9 on: May 18, 2013, 10:45:44 PM »
That's great, thanks again Phil.

Dino