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

Stripping the Path

0 views
Skip to first unread message

Steve Baker

unread,
Sep 19, 2001, 9:30:42 PM9/19/01
to
I'd like to make a directory listing in Win2000 without having the path
show up in the text. Sorry if this is in a non-NT group, but I know
someone knows the answer.

dir /s/b f:\*.mp3 > cdrom.m3u

Here is what is returned (sample).

f:\(AM Gold 1975) 02 Long Tall Glasses (I Can Dance) - Leo Sayer.mp3
f:\(AM Gold 1975) 03 Lady Marmalade - Labelle.mp3
f:\(AM Gold 1975) 05 Ballroom Blitz - Sweet.mp3

I'd like the f:\ to NOT show up after running this command.If that can't
be done, is there a way to strip the f:\ by another batch file? Any help
will be most appreciated.

Steve Baker

Phil Robyn

unread,
Sep 19, 2001, 10:32:48 PM9/19/01
to
Steve Baker wrote:

@echo off
for /f "tokens=*" %%a in ('dir /s /b f:\*.mp3') do call :strip "%%a"
goto :EOF
:strip
echo %~nx1>>cdrom.m3u
goto :EOF


--

u n z i p m y a d d r e s s t o s e n d e - m a i l


Clay Calvert

unread,
Sep 19, 2001, 10:49:05 PM9/19/01
to
On Thu, 20 Sep 2001 01:30:42 GMT, Steve Baker <sba...@yahoo.com>
wrote:

for /R f:\ %%I in (*.mp3) do echo %%~nxI>>cdrom.m3u

HTH

Clay Calvert
CCal...@Wanguru.com
Replace "W" with "L"

Steve Baker

unread,
Sep 22, 2001, 6:10:04 PM9/22/01
to
In article <3BA9554F...@uclink.berkzipeley.edu>,
pro...@uclink.berkzipeley.edu says...
Thank you very much, it worked fine. One small glitch though. Some of
the songs have an ampersand in them "&". The batch file somehow doesn't
know how to handle it and say so, then leaves out the song from the
file. Any suggestion? Thanks again.

Steve Baker

Phil Robyn

unread,
Sep 22, 2001, 8:44:01 PM9/22/01
to
Steve Baker wrote:

I don't have an 'f:\' drive on my machine at home, so I had to change the names.
You can change them back to meet your requirements.

-------------------------begin screen capture WinNT 4.0 SP6a----------------------
C:\CMD>dir /s /b d:\junkdir\*.mp3
d:\junkdir\(AM Gold 1975) 02 Long Tall Glasses (I Can Dance) - Leo Sayer.mp3
d:\junkdir\(AM Gold 1975) 03 Lady & Marmalade - Labelle.mp3
d:\junkdir\(AM Gold 1975) 05 Ballroom Blitz - Sweet.mp3

C:\CMD>demo\stripname

C:\CMD>type %temp%\cdrom.m3u


(AM Gold 1975) 02 Long Tall Glasses (I Can Dance) - Leo Sayer.mp3

(AM Gold 1975) 03 Lady & Marmalade - Labelle.mp3


(AM Gold 1975) 05 Ballroom Blitz - Sweet.mp3

C:\CMD>qblist demo\stripname.cmd
===== begin file C:\CMD\DEMO\stripname.cmd =====
01. @echo off
02. for /f "tokens=*" %%a in (
03. 'dir /s /b d:\junkdir\*.mp3'
04. ) do call :strip "%%a"
05. goto :EOF
06. :strip
07. set rec="%~nx1"
08. set rec=%rec:&=^&%
09. echo %rec:"=%>>%temp%\cdrom.m3u
10. goto :EOF
===== end file C:\CMD\DEMO\stripname.cmd =====
-------------------------end screen capture WinNT 4.0 SP6a-------------------------

Simon Sheppard

unread,
Sep 23, 2001, 5:21:04 AM9/23/01
to
On Sat, 22 Sep 2001 22:10:04 GMT, Steve Baker <sba...@yahoo.com>
wrote:

>In article <3BA9554F...@uclink.berkzipeley.edu>,

>pro...@uclink.berkzipeley.edu says...
>> Steve Baker wrote:
>>
>> > I'd like to make a directory listing in Win2000 without having the path
>> > show up in the text. Sorry if this is in a non-NT group, but I know
>> > someone knows the answer.
>> >
>> > dir /s/b f:\*.mp3 > cdrom.m3u
>> >
>> > Here is what is returned (sample).
>> >
>> > f:\(AM Gold 1975) 02 Long Tall Glasses (I Can Dance) - Leo Sayer.mp3
>> > f:\(AM Gold 1975) 03 Lady Marmalade - Labelle.mp3
>> > f:\(AM Gold 1975) 05 Ballroom Blitz - Sweet.mp3
>> >
>> > I'd like the f:\ to NOT show up after running this command.If that can't
>> > be done, is there a way to strip the f:\ by another batch file? Any help
>> > will be most appreciated.
>> >
>> > Steve Baker

If the files are all in the same folder then just leave out the /s

dir/b *.mp3 >index.m3u
-
Simon Sheppard
Web: http://www.ss64.com
email: Simon@ "

Dr John Stockton

unread,
Sep 23, 2001, 6:28:51 AM9/23/01
to
JRS: In article <MPG.161301ea9...@news-server.jam.rr.com>,
seen in news:alt.msdos.batch, Steve Baker <sba...@yahoo.com> wrote at
Thu, 20 Sep 2001 01:30:42 :-

>
>I'd like the f:\ to NOT show up after running this command.If that can't
>be done, is there a way to strip the f:\ by another batch file? Any help
>will be most appreciated.

You asked this on Sept 10 (UK time), and were given, in News, a range of
answers. If you feel a need to ask again, you should explain why the
existing answers do not suffice. Or is it that you are using a badly-
implemented system, in your machine or at your chosen ISP, that repeats
messages?

Any scripted editor should be more than capable of removing the
superfluous characters.

Or is it that you do not understand this medium, and expect answers only
by E-mail?

BTW, this newsgroup, news:alt.msdos.batch, is not an NT newsgroup, and
posting NT questions here is inconsiderate.

--
© John Stockton, Surrey, UK. j...@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

Steve Baker

unread,
Sep 24, 2001, 7:29:25 PM9/24/01
to
In article <3bada854...@news.demon.co.uk>, si...@spam.invalid
says...
They are not, but thanks anyway.

Steve

0 new messages