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
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
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
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
> 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)
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