|
 |
asp_web_howto thread: Counting files contained in a folder
Message #1 by gabriele@g... on Tue, 19 Jun 2001 08:32:23
|
|
Hello Everybody!
Does somebody know how to count the number of the files contained into a
folder?
I need to create a page for a photo gallery.
This page will have to build the thumbnails table adding one cell for each
image file (thumbnail) contained in the thumbs folder.
I couldn't find anything in the archive of this forum.
Thank you everybody!
Gabriele
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 19 Jun 2001 19:30:16 +1000
|
|
Did you look at the File System Object docs?
http://msdn.microsoft.com/scripting/vbscript/download/vbsdoc.exe
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: <gabriele@g...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Tuesday, June 19, 2001 8:32 AM
Subject: [asp_web_howto] Counting files contained in a folder
:
: Does somebody know how to count the number of the files contained into a
: folder?
:
: I need to create a page for a photo gallery.
: This page will have to build the thumbnails table adding one cell for each
: image file (thumbnail) contained in the thumbs folder.
Message #3 by prasadpatil_asp@1... on 19 Jun 2001 02:15:50 -0700
|
|
Hi gabriele,
It is possible to count no of files in a folder.
- first create filesystemobject.
- create folder object using getfolder method of filesysystem object(here
give folder name).
- get files collection of folder object using files property of folder
object
- you can get how many elelments present in a collection using count
propery. and this will be ur no of files in the folder
The code will look like this
Dim fso, f, f1, fc, s, no
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec) 'ur folder name
Set fc = f.Files
no = fc.count 'no of files in the folder
Let me know is this worked or not.
Regards,
Prasad Patil(prasadpatil_asp@1...)
On Tue, 19 June 2001, gabriele@g... wrote:
>
> Hello Everybody!
>
>
> Does somebody know how to count the number of the files contained into a
> folder?
>
> I need to create a page for a photo gallery.
> This page will have to build the thumbnails table adding one cell for each
> image file (thumbnail) contained in the thumbs folder.
>
> I couldn't find anything in the archive of this forum.
>
> Thank you everybody!
>
> Gabriele
Message #4 by bharath reddy <bharath_reddy@u...> on 19 Jun 2001 02:37:01 MDT
|
|
it is possible thru the filesystem object available in vbScript. there r
functions which will give u the collection of files in the directory. the
use
the (collection).length function to know no. of files in directory.
gabriele@g... wrote:
Hello Everybody!
Does somebody know how to count the number of the files contained into a
folder?
I need to create a page for a photo gallery.
This page will have to build the thumbnails table adding one cell for eac
h
image file (thumbnail) contained in the thumbs folder.
I couldn't find anything in the archive of this forum.
Thank you everybody!
Gabriele
Message #5 by gabriele@g... on Thu, 21 Jun 2001 19:55:17
|
|
THANK YOU VERY MUCH Ken, Prasad and the 3rd one who didn't sign the
message, for your replies!
I am now going to make it work!
Gabriele
|
|
 |