selecting .file range with FSO

They have: 11 posts

Joined: Aug 2001

hello,

i am trying to get a range of numbers 1-9, 10-18, 19-27 for a directory of gif images. I send through a query the page number

page 1 would be 1-9
page 2 would be 10-18
page 3 would be 19-27

and I then use the FSO like such:

for each ofile in ofolder.files
strarray(i) = "page1/" & stripfilename(ofile)
i = i +1
next

but instead of OFILE IN OFOLDER.FILES,
I want to put the range

I am not sure if this can be done, can anybody help?

"I'm a singer, not a programmer!"
[url]www.keithlubrant.com[/url]

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I'm lost.
What do you want to do to these files?
Do you know the name of the files?

Quicky Code (untested)

Page = Request.QueryString("Page")

Min = ((Page - 1) * PerPage) + 1
Max = (Page * PerPage)

i=1
j=1
For Each ofile in ofolder.files
    If (i > Min) AND (i < Max) Then
        strarray(j) = "page1/" & stripfilename(ofile)
        j = j + 1
    End If
    i = i + 1
Next
'This will determin the first and last file to handle, and do only handle these files in the For Loop. It's been a while since I've done any ASP, so there is probably a better way to do this. It was hard enough for me to keep from putting a semicolon on the end of every line. =P

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 11 posts

Joined: Aug 2001

that was what I was looking for....

Thank you! Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.