Well it isn't pretty but it works - it would be nice to have the code work regardless of how many levels are in the directory structure. Is there a way to get the artist-album info from the first line of each pair (the one starting with # that's currently ignored)?
The Directory structure under the target destination folder are now ARTIST-ALBUM folders:
FOR /F "tokens=1-6 delims=\ eol=#" %%A in (%playlist%) DO (xcopy "\\%%A\\%%B\\%%C\\%%D\\%%E\\%%F" "%TARGET%%%E\")
Used xcopy because I experimented with various options but in the end they're not needed.
Just one mini glitchette to sort out now. The real m3u files have spaces in them so I tried single quotes and double quotes on the SET statement but then the %playlist% substitution doesn't work because it's treated as a literal rather than a filename...
I think the usebackq option might be the one.
REM SET playlist=C:\Users\xxx\Desktop\samplem3u.txt
FOR /F "usebackq tokens=1-6 delims=\ eol=#" %%A in (%playlist%) DO (xcopy "\\%%A\\%%B\\%%C\\%%D\\%%E\\%%F" "%TARGET%%%E\")
This just tested fine for a small number of real music files in an extract from a real m3u file. It would be nice to solve the number of directory levels question so that parsing on the \character would result in a different number of variables depending on how deep the dir structure is.
But for me this works.