You are not logged in.
Hi guys.
I have a huge mp3-collection on my Archlinux server.
Folder structure of my music folder is as follows:
1994 - Guided By Voices - Bee Thousand
1994 - Helmet - Betty
1994 - House Of Pain - Same As It Ever Was
Each of the album folders contains of course the mp3s and cover art.
Now i want to mass rename/move the folders to this pattern:
Guided By Voices/1994 - Guided By Voices - Bee Thousand
Helmet/1994 - Helmet - Betty
House Of Pain/1994 - House Of Pain - Same As It Ever Was
So its a pretty simple task, from "%1 - %2 - %3" to "%2/%1 - %2 - %3"
But i failed so far. Can you help?
Last edited by janga (2009-05-27 15:03:22)
Offline
It should be simple w/ awk, have you tried it?
If you're not emotionally connected to spaces, please, consider deleting them and / or switching to underscores, like that: '_'.
Offline
I have not tried awk or sed yet, mainly because i am not a programmer, but a linux noob with little experience.
I need a newbie-friendly solution, like "do this and that".
And yes, i like space.:D
Oh and i tried mmv so far.
Last edited by janga (2009-05-27 14:45:37)
Offline
easytag might be able to do this for you.. the interface isn't the most intuitive but once you figure it out, it can be pretty powerful.
Offline
And yes, i like space.big_smile
And this will be your downfall ... ;-)
I can try writing a script for you but:
- you'll have to wait half a day,
- I'm a noob myself, so I'm not responsible for anything bad that might happen (the house on fire, your wife leaves you etc.). When you're trying sth out it's best to run in in a sandbox, f.e. copy some music and run the script on that copy, see if you like the output.
Offline
You can get the second part with cut, and trailing/leading spaces can be removed with a simple echo.
for file in *; do
[ -d "$file" ] || continue
dir=$(echo $(echo "$file" | cut -s -d- -f2))
[ -z "$dir" ] && continue
mkdir "$dir"
mv "$file" "$dir"
done
EDIT: Error: exit should be continue! Added -s for cut and the -z test.
Last edited by Procyon (2009-05-27 14:57:01)
Offline
karol, i have already made a testing dir (and i´m not married).
dmartins, i know easytag, but i´d rather work myself into awk than trying to understand this horrible GUI.
Offline
Woohoo! Procyon, it worked! Many thanks man. To all of you. Great distro, great community.
Offline
It's only horrible because you use spaces!
The unix/linux command line interpreter (ie the 'shell') splits a string into 'tokens' where each token is seperated by one or more blanks/tabs. Then it operates on these tokens.
When you use spaces you will have to do some acrobatics to make it work, eg: you have a file called 'old file' and you want to copy it to 'newfile'
cp old file newfile
will _not_ work as you anticipate, but
cp "old file" newfile
will do the needfull
[edit]
Spaces will cause you problems - sooner or later (unless you live in the M$-world) - your best bet would be to realize that straightaway and do away with them - use '-' or '_' instead.
[/edit]
Last edited by perbh (2009-05-27 15:11:42)
Offline