I'm trying to find a script that would basically look recusively at a directory, and if the script finds file that are
.flac files, it will create a subfolder called FLAC in that same folder, and move the
.flac files only into that directory. It may find 30 flac files in the same directory, so I don't want it to meltdown once it realizes the folder already exists, etc...
Example folder/file layout:
Base path is
Subdirectories currently look like
/files/music/artist /files/music/artist/album1 /files/music/artist/album2
Files appear as
/files/music/artist/album1/01-song 1.mp3 /files/music/artist/album1/01-song 1.flac /files/music/artist/album1/02-another song.mp3 /files/music/artist/album1/02-another song.flac /files/music/artist/album2/01-yet another.mp3 /files/music/artist/album2/01-yet another.flac
So essentially I want it to become:
/files/music/artist/album1/01-song1.mp3 /files/music/artist/album1/02-another song.mp3 /files/music/artist/album1/flac/01-song 1.flac /files/music/artist/album1/flac/02-another song.flac /files/music/artist/album2/01-yet another.mp3 /files/music/artist/album2/flac/01-yet another.flac
The whole idea, is that after scanning in a ton of my CDs, I have a lot of folders with mixed versions...so media players end up playing the song song twice (first the mp3 version, then the flac version)...
Is it possible to script something that would leave the directory as-is, if no mp3 files exist? (only flac?) Thus, if a folder had solely .flac files, it wouldn't create a subfolder...leave it as-is. The only hiccup I would see would be that it would have to look for mp3 files, as there might be other files in the folders (jpg cover files, etc..)