Plejlist Trikolor M3u
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. Spot on avery_larry your code works!! Thankyou ++++ I needed to change line 5 to append (>>) rather than overwrite (>) the text file. I made the code echo the results line-by-line in the console and added pauses between each line so I could visualize the runtime. Heroes and generals chiti na denjgi.
Yes sir, she kept outputting and outputting and outputting every line with relative path names. As you can see, I'm a DOS n00b. It would be nice for my learning if you could explain to me what each line is doing. What are the brackets doing from lines 3 to 6 and why are you indenting lines 4 and 5.
Iptv deutsch m3u playlist – free download June 1, 2018 March 3, 2019 Admin Iptv 1 Comment IPTV Germany updated IPTV Deutsch m3u playlist can be used on programs or device that supports the m3u format.
Ummm, one last thing. So to make your batch also rename listall.txt to [the name of the parent folder].m3u I add this code to the end of yours: set foldervar=%CD% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% ren listall.txt '%foldervar%.m3u' Is there a better way to code this function or do I really need to add all those lines?
I'm pretty sure the answer has something to do with the FOR command. Code: call echo%%file:%parent%=%%>>listall.txt This is where the magic happens. At the basic level, we're using a simple substring substitution to eliminate the parent directories. If your current directory was c: tmp then we're trying to do this: echo%file:c: tmp =% Which substitutes nothing (blank or nul) for c: tmp The rest of it I'm not going to explain very well, because it's quite complicated. The%parent% is the variable that contains the parent directory, which we want to blank out of the lines, effectively we are stripping 'c: my music parent folder' out of the dir's ouput.
That's what this portion does::%parent%= Using the 'call' function allows us to evaluate the variable string twice. The first evaluation will expand any normal looking variables (single% surround) and it will evaluate any double percents as single percents. Something like this. Ummm, one last thing. So to make your batch also rename listall.txt to [the name of the parent folder].m3u I add this code to the end of yours: set foldervar=%CD% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% set foldervar=%foldervar:* =% ren listall.txt '%foldervar%.m3u'Is there a better way to code this function or do I really need to add all those lines?
I'm pretty sure the answer has something to do with the FOR command. --thr333Well, you could do something similar to the above and strip out the parent folder from the current folder something like this: **untested**. Thanks for taking the time to write ALL of that!!
The last code example. Yeah, it works flawlessly, adding only this part to your previous code: Set 'foldervar=%CD%' for /l%%a in (1,1,10) do call set 'foldervar=%%foldervar:* =%%' Ren listall.txt '%foldervar%.m3u' What are the set of numbers in parenthesis (1,1,10) refering to again? The second last code example. Set 'folder=%cd%' cd. Call ren '%folder% listall.txt' '%%folder:%cd% =%%' When appended to your previous code doesn't work, even though It's much simpler looking.
Aren't we supposed to be adding.m3u file extension somewhere in here: '%%folder:%cd% =%%'. Well done DccD +++++ Thanks a lot for your contribution. Your added details are cool. I like a bit of interaction with scripts like this one. And another thankyou to avery_larry. Thanks for EVERYTHING +++++++ If anyone wants to copy and paste this and share it. Make sure you give credits to these guys and this forum makeplaylist.bat [Build 3 - September 02, 2009] - fixed illegal/special characters issue, see post by DccD further down - fixed bug when running batch from root of a drive, see post by DccD further down.