Option Explicit
On Error Resume Next
'The file type of the generated list
Const sListFileType = "wmv,rm,wma"
'The relative path to which the file is located
Const sShowPath="."
'Constant definition of sort type
Const iOrderFieldFileName = 0
Const iOrderFieldFileExt = 1
Const iOrderFieldFileSize = 2
Const iOrderFieldFileType = 3
Const iOrderFieldFileDate = 4
'Sorting the constant definition of inverse order
const iOrderAsc = 0
const iOrderDesc = 1
'The number of files that generate the list
const iShowCount = 20
'Date format function displayed
Function Cndate2(date1,intDateStyle)
dim strdate,dDate1
strdate=cstr(date1)
If Isdate(strdate) Then
If Left(cstr(strdate),1)="0" Then
dDate1=Cdate("20"+cstr(strdate))
else
dDate1=Cdate(strdate)
End If
Else
dDate1=Now()
End If
Select case intDateStyle
Case 1:
Cndate2 = Cstr(Year(dDate1))+"-"+Cstr(Month(dDate1))+"-"+Cstr(Day(dDate1))
Case 2:
Cndate2 = Cstr(Month(dDate1))+"-"+Cstr(Day(dDate1))
Case 3:
Cndate2 = Cstr(Month(dDate1))+"month"+Cstr(Day(dDate1))+"day"
Case 4:
Cndate2 = Cstr(year(dDate1))+"year"+Cstr(Month(dDate1))+"month"+Cstr(Day(dDate1))+"day"
End Select
End Function
Function ListFile(strFiletype,intCompare,intOrder,intShowCount)
Dim sListFile
Dim fso, f, f1, fc, s,ftype,fcount,i,j,k
Dim t1,t2,t3,t4,t5
Dim iMonth,iDay
sListFile = ""
Set fso = CreateObject("")
Set f = (sShowPath)
Set fc =
fcount =
redim arrFiles(fcount,5)
redim arrFiles2(fcount,5)
i=0
'Sort
For Each f1 in fc
ftype = right(,len()-instrrev(,"."))
arrFiles(i,0) =
arrFiles(i,1) = ftype
arrFiles(i,2) =
arrFiles(i,3) =
arrFiles(i,4) =
i=i+1
Next
For i=0 to fcount-1
for j=i+1 to fcount-1
select Case intCompare
Case iOrderFieldFileName,iOrderFieldFileExt,iOrderFieldFileType:
If arrFiles(i,intCompare)>arrFiles(j,intCompare) then
t1 = arrFiles(i,0)
t2 = arrFiles(i,1)
t3 = arrFiles(i,2)
t4 = arrFiles(i,3)
t5 = arrFiles(i,4)
arrFiles(i,0) = arrFiles(j,0)
arrFiles(i,1) = arrFiles(j,1)
arrFiles(i,2) = arrFiles(j,2)
arrFiles(i,3) = arrFiles(j,3)
arrFiles(i,4) = arrFiles(j,4)
arrFiles(j,0) = t1
arrFiles(j,1) = t2
arrFiles(j,2) = t3
arrFiles(j,3) = t4
arrFiles(j,4) = t5
end if
Case iOrderFieldFileSize:
If cdbl(arrFiles(i,intCompare))>cdbl(arrFiles(j,intCompare)) then
t1 = arrFiles(i,0)
t2 = arrFiles(i,1)
t3 = arrFiles(i,2)
t4 = arrFiles(i,3)
t5 = arrFiles(i,4)
arrFiles(i,0) = arrFiles(j,0)
arrFiles(i,1) = arrFiles(j,1)
arrFiles(i,2) = arrFiles(j,2)
arrFiles(i,3) = arrFiles(j,3)
arrFiles(i,4) = arrFiles(j,4)
arrFiles(j,0) = t1
arrFiles(j,1) = t2
arrFiles(j,2) = t3
arrFiles(j,3) = t4
arrFiles(j,4) = t5
end if
Case iOrderFieldFileDate:
If Cdate(arrFiles(i,intCompare))>Cdate(arrFiles(j,intCompare)) then
t1 = arrFiles(i,0)
t2 = arrFiles(i,1)
t3 = arrFiles(i,2)
t4 = arrFiles(i,3)
t5 = arrFiles(i,4)
arrFiles(i,0) = arrFiles(j,0)
arrFiles(i,1) = arrFiles(j,1)
arrFiles(i,2) = arrFiles(j,2)
arrFiles(i,3) = arrFiles(j,3)
arrFiles(i,4) = arrFiles(j,4)
arrFiles(j,0) = t1
arrFiles(j,1) = t2
arrFiles(j,2) = t3
arrFiles(j,3) = t4
arrFiles(j,4) = t5
end if
End Select
next
next
'Generate list
sListFile = sListFile + ("<table cellpadding=0 cellspacing=0 width=100% align=center class=""PageListTable"" style=""BEHAVIOR: url(images/); "">")
sListFile = sListFile + ("<THEAD><Tr class=PageListTitleTr><Td class=PageListTitleTd>")
sListFile = sListFile + ("name")
sListFile = sListFile + ("</td><Td class=PageListTitleTd>")
sListFile = sListFile + ("Media")
sListFile = sListFile + ("</td><Td class=PageListTitleTd>")
sListFile = sListFile + ("Size")
sListFile = sListFile + ("</td><Td class=PageListTitleTd>")
sListFile = sListFile + ("type")
sListFile = sListFile + ("</td><Td class=PageListTitleTd ID=updatetime>")
sListFile = sListFile + ("Update Time")
sListFile = sListFile + ("</td></Tr></THEAD>")
dim iLoopStart,iLoofEnd,iLoopStep
If intOrder = 0 then
iLoopStart = 0
iLoofEnd = fcount-1
iLoopStep = 1
Else
iLoopStart = fcount-1
iLoofEnd = 0
iLoopStep = -1
End if
dim iCount,sTDStyleClass
iCount = 1
For j=iLoopStart to iLoofEnd Step iLoopStep
If instr(strFiletype,arrFiles(j,1))>0 and iCount<=intShowCount then
sTDStyleClass = "PageListTd"+Cstr((iCount mod 2)+1)
sListFile = sListFile + ("<Tr class=PageListTr><Td class="+sTDStyleClass+">")
sListFile = sListFile + ("<img src=images/"+arrFiles(j,1)+".gif align=absbottom><img src= width=2 height=0><a href=" & sShowPath & "/" & CStr(arrFiles(j,0)) &">" & arrFiles(j,0) &"</a>")
If datediff("h",arrFiles(j,4),now)<=24 then
sListFile = sListFile + "<img src=images/ align=absmiddle>"
end if
sListFile = sListFile + "</td><Td class="+sTDStyleClass+">"
sListFile = sListFile + ("<a href=" & sShowPath & "/" & CStr(arrFiles(j,0)) &">")
'Create Chinese prompts according to the file name rules
select case left(arrFiles(j,0),3)
case "sc2":
sListFile = sListFile + "<font color=#AA0000>Sichuan Satellite TV "
case "sd2":
sListFile = sListFile + "<font color=#00AA00>Shandong TV "
case "gd2":
sListFile = sListFile + "<font color=#0000AA>Guangdong Satellite TV "
case "gx2":
sListFile = sListFile + "<font color=#AAAA00>Guangxi Satellite TV "
end select
'Date display
If isnumeric(left(right(arrFiles(j,0),8),2)) then
iMonth = cint(left(right(arrFiles(j,0),8),2))
iDay = cint(left(right(arrFiles(j,0),6),2))
sListFile = sListFile + cstr(iMonth)+"month" + cstr(iDay)+"day"
sListFile = sListFile + ("</a></td><Td class="+sTDStyleClass+" align=right>")
Else
arrFiles(j,0)
end if
If arrFiles(j,2)>1024*1024 then
sListFile = sListFile + cstr(round(arrFiles(j,2)/1024/1024))
sListFile = sListFile + ("MB")
else
sListFile = sListFile + cstr(round(arrFiles(j,2)/1024))
sListFile = sListFile + ("KB")
end if
sListFile = sListFile + (" </td>")
sListFile = sListFile + ("<Td class="+sTDStyleClass+">")
sListFile = sListFile + cstr(arrFiles(j,3))
sListFile = sListFile + ("</td>")
sListFile = sListFile + ("<Td class="+sTDStyleClass+">")
sListFile = sListFile + (Cndate2(arrFiles(j,4),4))
sListFile = sListFile + ("</td>")
sListFile = sListFile + ("</Tr>")
iCount = iCount+1
end if
next
sListFile = sListFile + "</table>"
ListFile = sListFile
End Function
'The process of generating the call file
Sub ShowFileListContent()
Dim tUpdatetime,sUpdateContent
Dim fso,f,f_js,f_js_write
Set fso = CreateObject("")
Set f = (sShowPath)
Set f_js = ("")
'Compare the last modification time of the call file and folder
If <>f_js.DateLastModified then
sUpdateContent = ListFile(sListFileType,iOrderFieldFileDate,iOrderDesc,iShowCount)
Set f_js_write = ("", True)
'JS call add the following pair
' f_js_write.Write ("('")
f_js_write.Write (sUpdateContent)
' f_js_write.Write ("')")
f_js_write.Close
End If
End Sub
Call ShowFileListContent()