Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileSystemObject

Status
Not open for further replies.

sujitopics

Programmer
Oct 9, 2001
69
KR
Hai
I am new to ASP
I used FileSystemObject to display all the files of my drive for ex : c:/ drive.
Is is possible to display only .html files ?
Is there any method in asp to display only that .html files
Thankyou VeryMuch
Yours
Suji
 
Hi sujitopics,

Try This:

Function GetFileList(Folder)
Dim oFSO, oFolder, oFile, oFiles
Dim sFileList

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(Folder)
Set oFiles = oFolder.Files

For Each oFile In oFiles
If oFile.Type = "HTML Document" Then
sFileList = sFileList & oFile.Name
sFileList = sFileList & &quot;<BR>&quot;
End If
Next

GetFileList = sFileList

End Function


Codefish
 
You can also try this:

For Each oFile In oFiles
If oFSO.getextensionname(oFile.name) = &quot;html&quot; Then
sFileList = sFileList & oFile.Name
sFileList = sFileList & &quot;<BR>&quot;
End If
Next


This should work. I thought there was some attribute to get the extension from each file, but I guess I am mistaken. This works good because you don't have to know the type...works if you create goofy extensions of your own or don't necessarily know the type description of .gif or .tiff etc.

Mike
 
Dear motte
Thankyou VeryMuch
Your Code helped me a lot
Thanks Once Again
Yours
Suji
 
sujitopics,

you're welcome. let me know if you need more help. i'm not the best at everything, but I can always lend a hand.

mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top