I need a batch file that will recursively list all the .mp3 and .flac files in the folder C:\Audio with the fullpath to a text file.
Eg. C:\Audio\Albums\AC DC\TNT\Tnt.mp3
C:\Audio\Singles\Cold Chisel - Bow River (live).mp3
C:\Audio\Albums\- Various Artists - 100% Hits Volume 13\11 - Collective Soul _ Shine.mp3
There are about 25,000 files. The files could named with any legal file name characters.
I would like the final result to be formatted as below:
{"Title": "Tnt.mp3","Fullpath": "c:/Audio/Albums/AC DC/TNT/Tnt.mp3"},
{"Title": "Cold Chisel - Bow River (live).mp3","Fullpath": "C:/Audio/Singles/Cold Chisel - Bow River (live).mp3"},
{"Title": "11 - Collective Soul _ Shine.mp3","Fullpath": "C:/Audio/Albums/- Various Artists - 100% Hits Volume 13/11 - Collective Soul _ Shine.mp3"},
I have done quite a lot of searching, but can't find anything that will do this.
There are various levels of directories.
I think I have covered everything.
Thank you for any help recieved.
List all mp3 and flac files recursively and save to text file
Moderator: DosItHelp
Re: List all mp3 and flac files recursively and save to text file
You could use a FOR /R loop.
Steffen
Code: Select all
@echo off &setlocal
>"list.txt" type nul
for /r "C:\Audio" %%i in (*.mp3 *.flac) do >>"list.txt" echo {"Title": "%%~nxi","Fullpath": "%%~fi"},
Steffen
Re: List all mp3 and flac files recursively and save to text file
Thank you Steffen, that works well. Only thing, is it hard to change all the back slashes to forward slashes.
Eg. "C:\Audio/Albums\- Various Artists - 100% Hits Volume 13\11 - Collective Soul _ Shine.mp3" should be "C:/Audio/Albums/- Various Artists - 100% Hits Volume 13/11 - Collective Soul _ Shine.mp3"},
Apart from that it works brilliantly.
Eg. "C:\Audio/Albums\- Various Artists - 100% Hits Volume 13\11 - Collective Soul _ Shine.mp3" should be "C:/Audio/Albums/- Various Artists - 100% Hits Volume 13/11 - Collective Soul _ Shine.mp3"},
Apart from that it works brilliantly.
Re: List all mp3 and flac files recursively and save to text file
Not at all.tlm2408 wrote:is it hard to change all the back slashes to forward slashes
Code: Select all
@echo off &setlocal
>"list.txt" type nul
for /r "C:\Audio" %%i in (*.mp3 *.flac) do (
set "fname=%%~nxi"
set "fpath=%%~fi"
setlocal EnableDelayedExpansion
>>"list.txt" echo {"Title": "!fname!","Fullpath": "!fpath:\=/!"},
endlocal
)
Steffen
Re: List all mp3 and flac files recursively and save to text file
That works perfect!!!! Thank you very, very much. You've made my day!