Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

batch for create m3u playlist

40 views
Skip to first unread message

Everett

unread,
Jul 16, 2008, 4:00:28 AM7/16/08
to
Hi all,

a friend write this batch for me. What i wanna get is a playlist m3u called
with the path of folders

ex. c:\mp3\Sandra Nasic\The signal will be Sandra Nasic - The signal.m3u

@echo off

for /R %%f in (*.mp3) do @call :salto %%~pf %%~nxf

:salto

set var1=%1

set var2=%var1:~+1%

if "%var2%"=="~+1" goto fine

set var2=%var2:\=.%

echo %2 >> %var1%%var2%m3u

:fine

It happens that the for /R is not recursive on my windows XP SP3(home,office
and another xp sp3)

This was my original batch , that work except the if errorlevel control
(give all time errorlevel 0 and don't reset )

@Echo off

dir /s /ad /b >> lista_dir.log
for /F "eol= tokens=1,2* delims=;" %%i in (lista_dir.log) do call :lista
%%i
:lista
set cart=%*
set nome=%cart:~+3%
set nome=%nome:\=-%
echo %nome%
cd %cart%
dir *.mp3
if ERRORLEVEL 0 (dir *.mp3 /b) >> "%nome%".m3u)
cd ..


Thank all for support

Everett


Ted Davis

unread,
Jul 16, 2008, 10:38:50 AM7/16/08
to
On Wed, 16 Jul 2008 10:00:28 +0200, Everett wrote:

> Hi all,
>
>
>
> a friend write this batch for me. What i wanna get is a playlist m3u
> called with the path of folders
>
>
>
> ex. c:\mp3\Sandra Nasic\The signal will be Sandra Nasic - The
> signal.m3u
>
>
>
> @echo off
>
> for /R %%f in (*.mp3) do @call :salto %%~pf %%~nxf
>
> :salto
>
> set var1=%1
>
> set var2=%var1:~+1%
>
> if "%var2%"=="~+1" goto fine
>
> set var2=%var2:\=.%
>
> echo %2 >> %var1%%var2%m3u
>
> :fine
>
>
>
> It happens that the for /R is not recursive on my windows XP
> SP3(home,office and another xp sp3)

I seem to recall there is a reason we don't often use that. That may be
it.

>
>
>
> This was my original batch , that work except the if errorlevel control
> (give all time errorlevel 0 and don't reset )
>
>
>
> @Echo off
>
> dir /s /ad /b >> lista_dir.log
> for /F "eol= tokens=1,2* delims=;" %%i in (lista_dir.log) do call
> :lista %%i
> :lista
> set cart=%*
> set nome=%cart:~+3%
> set nome=%nome:\=-%
> echo %nome%
> cd %cart%
> dir *.mp3
> if ERRORLEVEL 0 (dir *.mp3 /b) >> "%nome%".m3u) cd ..

The main problem with that last line is that the test is pointless:
errorlevel 0 is always true. Use

if not errorelvel 1

Errolevel 1 is true if errorlevel is not zero, so if errorlevel 1 is
false, then errorlevel is 0 and nothing else.


>
>
>
>
> Thank all for support
>
> Everett

I don't often see anyone with a name I share (there are few people whose
first name really is "Ted", and "Everett" (the "E." in T.E.D.) is rather
rare (rare enough that it's mispelled on my birth certificate).

--
T.E.D. (tda...@mst.edu)

billious

unread,
Jul 16, 2008, 11:23:34 AM7/16/08
to
Ted Davis wrote:
>
> I don't often see anyone with a name I share (there are few people
> whose first name really is "Ted", and "Everett" (the "E." in T.E.D.)
> is rather rare (rare enough that it's mispelled on my birth
> certificate).

I wonder whether Edward Everett Horton was know to his friends as "Ted" :)


Todd Vargo

unread,
Jul 16, 2008, 5:59:04 PM7/16/08
to

Both batch codes share a certain flaw (i.e. does not have a GOTO :EOF
following the FOR command that calls a subroutine directly below it.

About the /R, like the /D switch and %~s modifiers, is unreliable. However,
I suggest you remove the ">>" to see what is actually being expanded by your
variables.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

Richard Bonner

unread,
Jul 17, 2008, 8:34:27 AM7/17/08
to
Ted Davis (tda...@mst.edu) wrote:

*** Since it's on your birth certificate, Ted, is it not you who is
spelling it wrongly? (-:

Richard Bonner
http://www.chebucto.ca/~ak621/DOS/

Ted Davis

unread,
Jul 17, 2008, 9:43:47 AM7/17/08
to
On Thu, 17 Jul 2008 12:34:27 +0000, Richard Bonner wrote:

>
> *** Since it's on your birth certificate, Ted, is it not you who is
> spelling it wrongly? (-:

It was my father's middle name - he spelled it the same way I do. The
alternate spelling, with a final 'e' is rare - unknown in areas outside
of French influence. Mine came from an Everett family which figures in my
anscestory (one of the very few English family names - the family has been
pretty much all Welsh for the last 500 or so years (though my mother was
English/Scots-Irish/Welsh).

--
T.E.D. (tda...@mst.edu)

Richard Bonner

unread,
Jul 18, 2008, 8:30:50 AM7/18/08
to
Ted Davis (tda...@mst.edu) wrote:

> On Thu, 17 Jul 2008 12:34:27 +0000, Richard Bonner wrote:
> > *** Since it's on your birth certificate, Ted, is it not you who is
> > spelling it wrongly? (-:

> It was my father's middle name - he spelled it the same way I do.

> --
> T.E.D.

*** OK, that makes sense.

Richard Bonner
http://www.chebucto.ca/~ak621/DOS/

0 new messages