linuxpeter.de
  Batch, Scripts, Tools & Tips > Windows Batch and Tools  
 
Windows Batch and Tools
<< Remote shutdown tool for dlink DNS-323 Übersicht How to fix Sophos Update >>
flatster music folder cleanup and categorize tool The simple way to categorize and sort your mp3 files in the flatster music folder with a very small batch.

The problem:

I have a account on flatster music service (flatster.com). A great service for getting nice music together.
But the problem (for me) ist, that the flatster client moves all music to "C:\Program Files\flatster\Music".
No subfolders, no categories. Just a big directory full of mp3s.

I wanted to find a solution to sort these mp3s by artist in several subfolders.
The mp3s are all stored in the following format: METALLICA - The Day That Never Comes.MP3
So we have ARTIST - Songtitle.mp3

The solution:

Surprise - it's a batch
After several tries with "for" and "delims" I found that "oneliner", that does the trick:

CODE for sort-in-folders.bat:

@ECHO OFF
for /f "delims=- tokens=1,2" %%i in ('dir /b *-*.MP3') do (md SORTIERT\"%%i" & xcopy /Y /D "%%i-*" SORTIERT\"%%i")

That's all! That script cuts off the part before the dividing "-", creates a subfolder with that artists name in a folder named "SORTIERT" and copies all songs of that artist into the according folders.
The "/D" in the xcopy part lets us take care, that the songs are not copied every time the batch runs.
Only, if a song with the same name is newer or not existing.

I have chosen the copy option to keep the original mp3s, where they are. The "SORTIERT" folder is mirrored to my NAS, where I have the songs together with one subdirectory per artist.
Only little problem:

I have following folders: "AC" "AC DC" and "ACDC"
That happens, because the artist and song names sometimes differ a bit, when flatster shows you several sources for one song.
But that is no big deal. I only have a few of them and they are close together, so I see, whats up with them, if I can't find a song.

Feel free to use that code, if you are a flatster-user, too. Or if your files fit the same matrix

Always take care,

Pete



Zuletzt geändert von Bikerpete (admin)  am Nov 09 2008  um 1:20 AM
<< Remote shutdown tool for dlink DNS-323 Übersicht How to fix Sophos Update >>


Info

Buy me a coffee ...


 
Top! Top!