I have loads (around 6000!) mp3's which I'd like to just dump into sub directories, based on the name of the file. Currently they're all in a single subdir. (There are already some existing directories for some artists, I don't wish to touch the files in these however a duplicate overwriting an existing file is fine).
The simplest way I can see of doing this, is by creating a subdirectory based on the file name, as the files are all named artist.artist.album.track.mp3.
After some searching I've come up with:
for x in ./*.mp3; do awk x="${x}" -F. '{split(x,a,"."); mkdir a[1]; mv x a[1]/}'; done
However it tells me there's a syntax error and unterminated regexp:
awk: cmd. line:1: x=./Dizzee.Rascal.Radio.1.Live.Lounge.03.That.s.Not.My.Name.mp3
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: x=./Dizzee.Rascal.Radio.1.Live.Lounge.03.That.s.Not.My.Name.mp3
awk: cmd. line:1: ^ unterminated regexp
awk: cmd. line:1: x=./Dizzee.Rascal.Ultimate.Streetdance.CD1.03.Flex.Dave.Spoon.Mix.mp3
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: x=./Dizzee.Rascal.Ultimate.Streetdance.CD1.03.Flex.Dave.Spoon.Mix.mp3
awk: cmd. line:1: ^ unterminated regexp
I think this is because the file name isn't given within speech marks but I'm not 100% sure?
Can someone help - and bonus points if you can get it to print out the progress too.