I am looking for a vbscript that will display the first 100 files in a
directory that contains more than 100 files.

Re: Display first 100 files of directory by Pegasus

Pegasus
Fri Apr 25 00:41:03 CDT 2008


"Rob Pettigrew" <Rob Pettigrew@discussions.microsoft.com> wrote in message
news:F347130C-1A03-4653-B66D-F6DFDD98D193@microsoft.com...
>I am looking for a vbscript that will display the first 100 files in a
> directory that contains more than 100 files.

This wouldn't be the homework after Lesson #1 in a VB Script
course? If yes then you need to consider:
- What is "first 100 names"? Sorted by date, size or name?
- How will you look at these lines? Most will scroll off the
screen.



Re: Display first 100 files of directory by Alex

Alex
Fri Apr 25 07:35:50 CDT 2008

More context would definitely be helpful for this question: OS version, why
VBScript, etc. Otherwise, I would just download a head.exe tool and use the
cmd shell's DIR command...

"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:#xz40bppIHA.3860@TK2MSFTNGP02.phx.gbl...
>
> "Rob Pettigrew" <Rob Pettigrew@discussions.microsoft.com> wrote in message
> news:F347130C-1A03-4653-B66D-F6DFDD98D193@microsoft.com...
>>I am looking for a vbscript that will display the first 100 files in a
>> directory that contains more than 100 files.
>
> This wouldn't be the homework after Lesson #1 in a VB Script
> course? If yes then you need to consider:
> - What is "first 100 names"? Sorted by date, size or name?
> - How will you look at these lines? Most will scroll off the
> screen.
>

Re: Display first 100 files of directory by Alexander

Alexander
Fri Apr 25 16:43:23 CDT 2008

Rob Pettigrew schrieb:
> I am looking for a vbscript that will display the first 100 files in a
> directory that contains more than 100 files.



@echo off
pushd %SYSTEMROOT%\SYSTEM32
setlocal enabledelayedexpansion
set C=1

for /F "delims=" %%A in ('dir /on /a-d /b') do (
if !C! gtr 100 goto exit
set /A C += 1
echo %%~nxA %%~tA %%~zA
)
:exit
popd








MfG,
Alex

Re: Display first 100 files of directory by defragster

defragster
Sun Jun 01 14:16:01 CDT 2008

Cool routine - but the Pushd and PopD fail for me on Vista x64 unless I
re-order the pushD as follows:

setlocal enabledelayedexpansion
set C=1
pushd %SYSTEMROOT%\SYSTEM32

"Alexander Mueller" wrote:

> @echo off
> pushd %SYSTEMROOT%\SYSTEM32
> setlocal enabledelayedexpansion
> set C=1