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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display File name with FSO

Status
Not open for further replies.

VitoCorleone

Programmer
Jun 22, 2004
28
GB
I have created a dynamic site map in asp using FSO which displays all the files in a particular folder and exclude file extensions such as .xls, .ppt etc so only my asp and html pages are listed.

Now.... when the files are displayed, the FSO diplays the file name. example - 'gs_finance_team.asp'.

for the users i want the name 'Finance Team' to show and not 'gs_finance_team.asp'. So the user knows what it is and i haave a dynamically driven page. Here is a sample of the code I have been using -


----------------------------------------------------------
Dim myteam
Dim people
Dim finance
Dim comm
Dim polices
Dim data
Set myteam = fso.GetFolder(Server.MapPath("/cfo/organisation/"))
Set people = fso.GetFolder(Server.MapPath("/cfo/people/"))
Set finance = fso.GetFolder(Server.MapPath("/cfo/financial_results/"))
Set comm = fso.GetFolder(Server.MapPath("/cfo/communications/"))
Set polices = fso.GetFolder(Server.MapPath("/cfo/processes/"))
Set data = fso.GetFolder(Server.MapPath("/cfo/data_systems/"))

'create a string of dissallowed extensions (lowercase)
DissallowList = "|xls|doc|bak|msg|pdf|ppt|log|aspx|"
for each x in myteam.files

FileExt = Mid(x.Name, InStrRev(x.Name, ".")+1, Len(x.Name) - InStrRev(x.Name, ".") + 1)
If Instr(DissallowList,"|" & lcase(FileExt) & "|") = 0 Then
'Print the name of all files in the test folder
Response.write "<tr><td><a href='/cfo/organisation/" & x.Name & "'>" & x.Name & "</a></td>"

End If
next
%>

-----------------------------------------------------

Can You Help
 
Code:
dim fNameArray
fNameArray = split(x.name,".")

will give the

filename in fNameArray(0)
fileext in fNameArray(1)


Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Whether or not you can do this depends on if there is a naming convention for the files. Is there One? If so, what is it?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
TomThumbKP,

I have been using html and asp pages. I dont think i have a consistent naming convention. sone files are names sale.asp and some forgotten_password.asp to gs_finance_team.asp

ChrisHirst,

Thanks for the reply i will let you know how i got on with the code.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top