blodefood
10-27-2003, 12:45 PM
I have this code that displays filenames in a folder according to the first character of the filename.
I need to parse the filename W20031024-ID01.xls or M20031024-ID01.xls so that the text in the hyperlink displays as a date. Note that I can change the file naming conventions if that would make it easier.
e.g. October 24, 2003
I trust I have commented the code adequately.
Would appreciate some assistance. Thanks.
<%
dim strWeekly, strMonthly
strPath = "D://Wwwroot/test/newfolder/ID01/"
dim oFS, oFile, oFolder, oFolderContents, slot, varname
'slot corrects a path discrepency on the testing server
'it will be removed once it goes on the live server
slot="ID01/"
varname=left(oFile,1)
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFS.getFolder(strPath)
For Each oFile In oFolder.files
If Left(oFile.Name, 1) = "W" Then
strWeekly = strWeekly & _
" <a href=""" & slot & oFile.Name & """>" & _
oFile.Name & "</a><br>"
ElseIf Left(oFile.Name, 1) = "M" Then
strMonthly = strMonthly & _
" <a href=""" & slot & oFile.Name & """>" & _
oFile.Name & "</a><br>"
End If
Next
'after this is complete we will parse the filenames to English
%>
And this in the body of the document to display filenames in their appropriate columns in the table.
<td><% = strWeekly%></td>
<td><% = strMonthly%></td>
I need to parse the filename W20031024-ID01.xls or M20031024-ID01.xls so that the text in the hyperlink displays as a date. Note that I can change the file naming conventions if that would make it easier.
e.g. October 24, 2003
I trust I have commented the code adequately.
Would appreciate some assistance. Thanks.
<%
dim strWeekly, strMonthly
strPath = "D://Wwwroot/test/newfolder/ID01/"
dim oFS, oFile, oFolder, oFolderContents, slot, varname
'slot corrects a path discrepency on the testing server
'it will be removed once it goes on the live server
slot="ID01/"
varname=left(oFile,1)
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFS.getFolder(strPath)
For Each oFile In oFolder.files
If Left(oFile.Name, 1) = "W" Then
strWeekly = strWeekly & _
" <a href=""" & slot & oFile.Name & """>" & _
oFile.Name & "</a><br>"
ElseIf Left(oFile.Name, 1) = "M" Then
strMonthly = strMonthly & _
" <a href=""" & slot & oFile.Name & """>" & _
oFile.Name & "</a><br>"
End If
Next
'after this is complete we will parse the filenames to English
%>
And this in the body of the document to display filenames in their appropriate columns in the table.
<td><% = strWeekly%></td>
<td><% = strMonthly%></td>