473,388 Members | 1,230 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Reading filenames in a folder

Hi All,

I would like to read the contents of folder and display
filtered results in my page. Can someone point me in a
direction just to get me started, Thanks.

TIA

Best Regards,
Steve Karnath
Jul 19 '05 #1
6 9622
File Lister:
http://www.darkfalz.com/1069

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Steve Karnath" <sk******@sbcglobal.net> wrote in message
news:06****************************@phx.gbl...
Hi All,

I would like to read the contents of folder and display
filtered results in my page. Can someone point me in a
direction just to get me started, Thanks.

TIA

Best Regards,
Steve Karnath

Jul 19 '05 #2
in order to list a folder content you can use a function like this one :

' The filtering condition is extention=htm

---<Code to paste>---
Const MyFolder="d:\Files"

set Fso=Server.CreateObject("Scripting.FileSystemObjec t")
Set Fld=Fso.getFolder(MyFolder)
for each F in Fld.File
if lcase(right(F.Name,3))="htm" then
response.write F.Name & "<br>"
end if
next
---</Code to paste>---

"Steve Karnath" <sk******@sbcglobal.net> a écrit dans le message de
news:06****************************@phx.gbl...
Hi All,

I would like to read the contents of folder and display
filtered results in my page. Can someone point me in a
direction just to get me started, Thanks.

TIA

Best Regards,
Steve Karnath

Jul 19 '05 #3
<%
Const PATH_ON_SERVER = "D:\Path"

Dim oFSO, oDir
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
Set oDir = oFSO.GetFolder(PATH_ON_SERVER)
For Each oFile In oDir.File
Response.Write oFile.Name & "<br>"
Next
Set oDir = Nothing
Set oFSO = Nothing
%>

For your filtering, use if/then on whatever file property you'd like to
filter by. To see what properties would be available for each oFile in
oDir, see
http://msdn.microsoft.com/library/en.../jsobjFile.asp

Ray at home
"Steve Karnath" <sk******@sbcglobal.net> wrote in message
news:06****************************@phx.gbl...
Hi All,

I would like to read the contents of folder and display
filtered results in my page. Can someone point me in a
direction just to get me started, Thanks.

TIA

Best Regards,
Steve Karnath

Jul 19 '05 #4
neither example works
oDir.File fails on this example
"Ray at home" <myfirstname at lane 34 . komm> wrote in message
news:uL**************@TK2MSFTNGP12.phx.gbl...
<%
Const PATH_ON_SERVER = "D:\Path"

Dim oFSO, oDir
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
Set oDir = oFSO.GetFolder(PATH_ON_SERVER)
For Each oFile In oDir.File
Response.Write oFile.Name & "<br>"
Next
Set oDir = Nothing
Set oFSO = Nothing
%>

For your filtering, use if/then on whatever file property you'd like to
filter by. To see what properties would be available for each oFile in
oDir, see
http://msdn.microsoft.com/library/en.../jsobjFile.asp

Ray at home
"Steve Karnath" <sk******@sbcglobal.net> wrote in message
news:06****************************@phx.gbl...
Hi All,

I would like to read the contents of folder and display
filtered results in my page. Can someone point me in a
direction just to get me started, Thanks.

TIA

Best Regards,
Steve Karnath


Jul 19 '05 #5
should be Fs.Files or oDir.Files
"Bite My Bubbles" <bm*@mybubbles.com> wrote in message
news:OT**************@TK2MSFTNGP09.phx.gbl...
neither example works
oDir.File fails on this example
"Ray at home" <myfirstname at lane 34 . komm> wrote in message
news:uL**************@TK2MSFTNGP12.phx.gbl...
<%
Const PATH_ON_SERVER = "D:\Path"

Dim oFSO, oDir
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
Set oDir = oFSO.GetFolder(PATH_ON_SERVER)
For Each oFile In oDir.File
Response.Write oFile.Name & "<br>"
Next
Set oDir = Nothing
Set oFSO = Nothing
%>

For your filtering, use if/then on whatever file property you'd like to
filter by. To see what properties would be available for each oFile in
oDir, see
http://msdn.microsoft.com/library/en.../jsobjFile.asp

Ray at home
"Steve Karnath" <sk******@sbcglobal.net> wrote in message
news:06****************************@phx.gbl...
Hi All,

I would like to read the contents of folder and display
filtered results in my page. Can someone point me in a
direction just to get me started, Thanks.

TIA

Best Regards,
Steve Karnath



Jul 19 '05 #6
Oops. Thanks.

Ray at home

"Bite My Bubbles" <bm*@mybubbles.com> wrote in message
news:#d**************@TK2MSFTNGP11.phx.gbl...
should be Fs.Files or oDir.Files

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: DaRemedy | last post by:
Hiya, If I had several folders full of images, how can I get PHP to open the folder, read the image names and save the image names (inc extension) to a MySQL database? What I am trying to do...
1
by: Joel Goldstick | last post by:
I wanted to write a simple page to let me choose a directory and then list the files in it. The end goal was to make an easy way to copy all the file names in a directory. I tested with Opera7,...
5
by: Mark | last post by:
How can I populate a listbox with a list of the filenames in a certain folder? Can a query retrieve the filenames from a folder? Thanks! Mark
2
by: rbutch | last post by:
guys, i need a little help with this. this is working (well sort of) i get the info, but it's not moving to a new line as it iterates thru the array and all of the fields are like ONE HUGE LONG...
6
by: I_AM_DON_AND_YOU? | last post by:
I have a small VB.Net Solution. The solution has filename LABELMAKER.SLN and the the project has filename LABELMAKER.VBPROJ. There is another file LABELMAKER.VBPROJ.USER. All these are in a...
1
by: DOM_scripter | last post by:
Hi, I want to make an automatic foto album that lets me only drop a bunch of pictures in a folder. When I open the browser a javascript should read all the filenames in the folder, show thumbnails...
4
waynetheengineer
by: waynetheengineer | last post by:
Hello everyone :) I am trying to write VB code for reading filenames and file property values in a specific directory. For example, I have a directory called C:/Bears and in that directory...
0
by: ColdCoffee | last post by:
Scenario: My computer: name : PrasComp pass : Pras123 Domain : XYZ Computer I wanna access: Name : AnoComp pass : #Pras
0
by: chongming | last post by:
Hi, i want to display all the filenames on browser. However i found that if there are many filenames in that folder, result will be it will display a long list of filenames on that browser. My...
6
by: kimiraikkonen | last post by:
Hello, I have a listbox and folder browser control. I need to display all .mp3 files' pathes into listbox. It was Ok with openfiledialog but how can list all .mp3 extension- having files into...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.