5

I'm using RHEL7 on my Server, and I have a directory containing thousands of myriads of mixed .mp3 files and I need a script helping me to clean up that chaos.

Let’s pretend 10 of my songs are for Miley Cyrus, 10 are for Ed Sheeran, 10 for Beethoven, 10 for Mozart and etc. All mp3 files are holding a numeric file name like 000.mp3, 001.mp3, and etc.

Now I want to write a script to read metadata of all those .mp3 files, and mv each file to a new created directory by the name of the singer. Ed Sheeran’s to Ed Sheeran directory.

How can I have this by writing a shell script, or perl script?

5
  • 1
    Someone already did this: search.cpan.org/~jv/mp3rename/script/mp3rename Aug 29, 2016 at 11:13
  • @Rahul Nothing that perfect in fact, I just know how to use find to locate all my .mp3 files. I know we have some packages on Ubuntu, but I don't know what I can do on RHEL. Aug 29, 2016 at 11:21
  • @IporSircer No that couldn't help. Mp3rename doesn't exist on RHEL7, like mp3info. BTW, I need a script, I need more detail. I'll be so grateful if you can help me that way. Thanks by the way. Aug 29, 2016 at 11:23
  • mp3rename is a cpan module, and redhat also has perl-cpan. rpmfind.net/linux/rpm2html/search.php?query=perl-CPAN It is a script. Aug 29, 2016 at 11:25
  • @IporSircer Oh my bad, yes you're right, thanks. I will check if I can do what I'm looking for with it or not. Thanks a million. Aug 29, 2016 at 11:31

1 Answer 1

4

With exiftool:

exiftool '-Directory<Artist' ./*.mp3

Recursively:

exiftool -ext mp3 '-Directory<$Directory/$Artist' -r .
1
  • It works like a magic, Thanks a million👍🙏 Aug 29, 2016 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .