Let's say we have a target directory structure like this:
C:\My Music\parent folder\01 - parent folder.mp3
C:\My Music\parent folder\02 - parent folder.mp3
C:\My Music\parent folder\03 - parent folder.mp3
C:\My Music\parent folder\child folder 1\01 - child folder 1.mp3
C:\My Music\parent folder\child folder 1\02 - child folder 1.mp3
C:\My Music\parent folder\child folder 1\03 - child folder 1.mp3
C:\My Music\parent folder\child folder 2\01 - child folder 2.mp3
C:\My Music\parent folder\child folder 2\02 - child folder 2.mp3
C:\My Music\parent folder\child folder 2\03 - child folder 2.mp3
So...
If I just run Command Prompt from the 'parent folder' and type:
- dir /s /b *.mp3 > listall.txt
I get an output text file with absolute path exactly as you see above.
But this is not what I want.
I want a master playlist file dumped at "parent folder" which lists all, including subdirectories,
AND ALSO
output the text with relative path names (having "parent folder" as root)
AND ALSO
auto-name the playlist file as [the name of the parent folder].m3u
So we end up with this (example):
parent folder.m3u
--------------------------------------------------------------
parent folder\01 - parent folder.mp3
parent folder\02 - parent folder.mp3
parent folder\03 - parent folder.mp3
parent folder\child folder 1\01 - child folder 1.mp3
parent folder\child folder 1\02 - child folder 1.mp3
parent folder\child folder 1\03 - child folder 1.mp3
parent folder\child folder 2\01 - child folder 2.mp3
parent folder\child folder 2\02 - child folder 2.mp3
parent folder\child folder 2\03 - child folder 2.mp3
--------------------------------------------------------------
This code here recurses all subdir,
and dumps separate playlist.m3u files in each subdir (Bad, not what I want)
- for /R %%A in (*.mp3) do @echo %%~nxA >> "%%~dpAplaylist.m3u"
This code will create a master playlist (Good +++)
and recurses all subdir
and renames it to [the name of the parent folder].m3u:
- CD %1
Dir /o:n /s /b *.mp3 > TempPlaylist.m3u
Set foldervar=%CD%
Set foldervar=%foldervar:*\=%
Set foldervar=%foldervar:*\=%
Set foldervar=%foldervar:*\=%
Set foldervar=%foldervar:*\=%
Set foldervar=%foldervar:*\=%
Ren TempPlaylist.m3u "%foldervar%.m3u"
Close, but no cigar...
I'm still left with absolute path names in the playlist
There is a simple solution to this... but
I guess I'm not savvy enough to see it.
Cheers.