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 10, 2001, 12:17:30 AM9/10/01
to
I'd like to make a directory listing in Win2000 without having the path
show up in the text.

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

Al Dunbar

unread,
Sep 10, 2001, 1:01:43 AM9/10/01
to

"Steve Baker" <sba...@yahoo.com> wrote in message
news:MPG.1605fa161...@news-server.jam.rr.com...

Something along these lines might work:

del cdrom.m3u
for /R %%F in (F:\*.mp3) do call:emitwithoutpath "%%F"
goto:eof

:emitwithoutpath
>>cdrom.m3u echo. %~pnx1
goto:eof

This will, I think, retain the leading "\". If you want to turf that as
well, try:

:emitwithoutpath
set zzz=%1
>>cdrom.m3u echo. %zzz:F:\=%
goto:eof

/Al


William Allen

unread,
Sep 10, 2001, 2:48:52 AM9/10/01
to
Steve Baker wrote in message

Apart from using FOR IN DO to parse the DIR output, you might
check to see whether or not the Win2000 XCOPY backup tool
supports the listing-only switch and list format of the Win95/98/ME version.

The /L switch of XCOPY _lists_ what _would be copied, but
without copying the files. So for example, on my Win95 system:

xcopy A:\*.mp3 *.* /L /S /Y

will produce the listing you require _without_ the drive letter prefix.
(I have capitalised the switches for clarity, they are not case
sensitive. Type XCOPY /? for brief help and switches supported)

The XCOPY target, simply *.* in the above example, is irrelevant
since no copy is made. However, such a wildcard is a simple way
of avoiding a stall at the prompt:
Does YourTargetNameHere specify a file name
or directory name on the target
(F = file, D = directory)?

In general, use the /Y switch with /L listings to avoid a stall
if the target happens to contain a conflicting file. (No file is
copied with /L but XCOPY checks the overwrite condition to
establish what files should be listed.)

In Windows 95/98/ME GUI, the XCOPY listings are often useful,
since an XCOPY listing (with /H switch) recursively searches fully
through hidden and system folders, unlike DIR.

The following screen capture (using a mockup on A: floppy)
shows the difference in the formats of DIR and XCOPY listings.
An XCOPY listing may need separate sorting, since, unlike
DIR, it has no intrinsic support for a sort of the output.

============Screen capture from Windows 95
C:\WORK>dir a:\*.mp3 /s /b
A:\(AM Gold 1975) 02 Long Tall Glasses (I Can Dance) - Leo Sayer.mp3
A:\(AM Gold 1975) 03 Lady Marmalade - Labelle.mp3
A:\(AM Gold 1975) 05 Ballroom Blitz - Sweet.mp3
A:\Celine Dion\D'eux - Destin.mp3
A:\Celine Dion\D'eux - track 2 - Le Ballet.mp3
A:\Enya\Watermark - Cursuum Perficio.mp3

C:\WORK>xcopy a:\*.mp3 *.* /L /S /Y


(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

Celine Dion\D'eux - Destin.mp3
Celine Dion\D'eux - track 2 - Le Ballet.mp3
Enya\Watermark - Cursuum Perficio.mp3
6 File(s)

C:\WORK>xcopy a:\*.mp3 *.* /L /S /Y | find /v " File(s)"


(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

Celine Dion\D'eux - Destin.mp3
Celine Dion\D'eux - track 2 - Le Ballet.mp3
Enya\Watermark - Cursuum Perficio.mp3

C:\WORK>

============End screen capture

--
William Allen


Ray J

unread,
Sep 10, 2001, 4:24:23 PM9/10/01
to
I know this doesn't answer the question, but why bother removing
the path?

At home, I run a batchfile called updatemp3.bat that does a
dir /s/b w:\ > playlist.m3u
of a network drive to update my playlist. Same thing as what you're
doing - winamp has no problems at all.

Ray

Steve Baker

unread,
Sep 10, 2001, 10:06:23 PM9/10/01
to
In article <3B9D2177...@yaktam.com>, r...@yaktam.com says...
I'm manually taking the f:\ out of the lines because I'm using the m3u's
to edit mp3 listings pages on my website. Some of my listings are quite
lengthy and manually taking out the f:\ is a bit bothersome. I sometimes
use the find and replace in my HTML editor but for some reason it won't
take out the backslash. It treats it as some kind of different character
and won't replace it with a blank. I've already made the webpages with
the mp3 listings by making m3u files by doing a
"dir /s/b f:\*.mp3 > artists.m3u" where f:\ is my cdrom.
All I'm looking for is to have the f:\ taken off before I go in and
edit.
Sorry if I posted in the MSDOS group. I didn't do it by mistake because
I know there are many out there that will help in other groups besides
Win2000 even if it is an NT or 2000 question.
Thanks again.
Steve Baker

Todd Vargo

unread,
Sep 11, 2001, 12:03:52 AM9/11/01
to

"Steve Baker" <sba...@yahoo.com> wrote in message
news:MPG.16072cd1...@news-server.jam.rr.com...

> In article <3B9D2177...@yaktam.com>, r...@yaktam.com says...
> > I know this doesn't answer the question, but why bother removing
> > the path?
> >
> > At home, I run a batchfile called updatemp3.bat that does a
> > dir /s/b w:\ > playlist.m3u
> > of a network drive to update my playlist. Same thing as what you're
> > doing - winamp has no problems at all.
<snip>

> Sorry if I posted in the MSDOS group. I didn't do it by mistake because
> I know there are many out there that will help in other groups besides
> Win2000 even if it is an NT or 2000 question.
> Thanks again.
> Steve Baker

Ouch! Don't you think your over reacting just a bit? Sure you cross posted
to some conflicting groups, but Ray had no way to know what your reasons
were, that's why he asked a question. Now that the reason is known, I'll
offer another suggestion.

Use a text editor instead of an html editor to replace the "F:\" with "<a
href=". You'll also likely want to replace all backslashes with forward
slashes.

If you find this suggestion don't fit your needs or unhelpful, feel free to
ignore it and just move on to the next suggestion.

--
Todd Vargo (body of message must contain my name to reply by email)

Ray J

unread,
Sep 12, 2001, 1:04:40 PM9/12/01
to
I didn't mean to come across as nasty.
I thought maybe he didn't need to remove the path - Winamp works
with the path, and it looked like that's what he was doing with the
batch file - creating a playlist.

Al's suggestion should work fine.

Or, here's another (ugly) way to do it:

del playlist.m3u
dir /s/b e:\ > %temp%\playlist.m3x
for /f "tokens=2 delims=:" %%x in (%temp%\playlist.m3x) do (
echo %%x >> playlist.m3u)
del %temp%\playlist.m3x

This will strip of the drive letter and colon (it leaves the first
backslash.)

Or you could use alter.exe - I forgot where I got it from - it's
a free command line search/replace util. Check simtel.net - it's
an old dos util, or I could email it to you.

Ray

0 new messages