Print Page | Close Window

File system object

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=12267
Printed Date: 30 March 2026 at 10:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: File system object
Posted By: zaboss
Subject: File system object
Date Posted: 21 October 2004 at 9:27am
I am building a download page. The problem is that I need to list in it only .zip files, not all folder content. And since there might be many files to download, I need to page them, so, I need to count all the .zip files, in order to build pages...

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



Replies:
Posted By: dj air
Date Posted: 22 October 2004 at 9:46am
run a File name check

<%


dim filesys, strType, Extention, files, No_Files strFolderPath

No_Files = 0

strFolderPath = ""

Set filesys = CreateObject("Scripting.FileSystemObject")
Set Extention = filesys.GetFolder(strFolderPath)

Set files = Extention.Files
For Each fil in files

strType = Right(fil.name,4)


         &nbs p;      If Lcase(strType)  = ".zip" Then No_Files = No_Files  +1
Next 

response.write No_Files
%>


the code above will give you the figure for the number of files with .zip on the end of the file.

if you have problems just let me know.

the above example can be seen here www.breathofair.info/test.asp



Posted By: zaboss
Date Posted: 23 October 2004 at 3:52am
Thanks, that worked...

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web


Posted By: Mattblack
Date Posted: 27 October 2004 at 9:13am

damn! i never realised i could use the LCase thing, that wudve made a job of mine much easier some time ago (yes using all the options)



Posted By: theSCIENTIST
Date Posted: 28 October 2004 at 12:22pm


All options? You mean all combinations like (.zip, .Zip, .ZIP ...) and so on, damn there's a few combinations there :)

You just put a smile in my face on a very dull day. Thx.

-------------
:: http://www.mylittlehost.com/ - www.mylittlehost.com


Posted By: Gullanian
Date Posted: 28 October 2004 at 12:49pm
16 infact, 2^4.


Posted By: Mattblack
Date Posted: 28 October 2004 at 1:24pm

yea, try it on ASPX files where you want any files ending with aspx that people upload to be deleted.

Theres loads of options, aspx, Aspx, aSpx, asPx, aspX, ASpx, AsPx, AspX, aSPx, aSpX, asPX, ASPx, ASpX, aSPX, AsPX.... think thats it




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net