PDA

View Full Version : Listing a limited number of files



ABreese
12-07-2001, 04:32 AM
I posted this yesterday, but to the wrong forum.

Is there anyway I can use a <dir> command but limit the amount of output to a certain number of files. So when the limit is reached it stops listing files?

ELSE

Is there a way I can trim a text file to a certian number of lines? So I can redirect the output of a <dir /b> into a text file and then delete everything after line <n>

--Thanks
ABreese

ABreese
12-07-2001, 04:42 AM
I found an answer myself, I am posting it just incase someone else has a similar need.


set varMaxCount=5
for %%A in (%varSourceDirectory%\*.drw) do (call :proChoose)

:proChoose
set /A varCount=%varCount% + 1
if %varCount% gtr %varMaxCount% (call :pro2) ELSE (call :pro1)


:pro1
echo %%A >> output.txt

:pro2
Exit