%
'**********
'Purpose:
' 1. To create a recordset using the FSO object and ADODB
' 1. Call the function when you're ready to open the recordset
' and output it onto the page.
'**********
Function kc_fsoFiles(theFolder, Exclude)
Dim rsFSO, objFSO, objFolder, File
Const adInteger = 3
Const adDate = 7
Const adVarChar = 200
'create an ADODB.Recordset and call it rsFSO
Set rsFSO = Server.CreateObject("ADODB.Recordset")
'Open the FSO object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'go get the folder to output it's contents
Set objFolder = objFSO.GetFolder(theFolder)
'Now get rid of the objFSO since we're done with it.
Set objFSO = Nothing
'create the various rows of the recordset
With rsFSO.Fields
.Append "Name", adVarChar, 200
.Append "Type", adVarChar, 200
.Append "DateCreated", adDate
.Append "DateLastAccessed", adDate
.Append "DateLastModified", adDate
.Append "Size", adInteger
.Append "TotalFileCount", adInteger
End With
rsFSO.Open()
'Now let's find all the files in the folder
For Each File In objFolder.Files
'hide any file that begins with the character to exclude
If (Left(File.Name, 1)) <> Exclude Then
rsFSO.AddNew
rsFSO("Name") = File.Name
rsFSO("Type") = File.Type
rsFSO("DateCreated") = File.DateCreated
rsFSO("DateLastAccessed") = File.DateLastAccessed
rsFSO("DateLastModified") = File.DateLastModified
rsFSO("Size") = File.Size
rsFSO.Update
End If
Next
'And finally, let's declare how we want the files
rsFSO.Sort = "DateCreated DESC, DateLastModified DESC "
'Now get out of the objFolder since we're done with it.
Set objFolder = Nothing
'now make sure we are at the beginning of the recordset
'not necessarily needed, but let's do it just to be sure.
rsFSO.MoveFirst()
Set kc_fsoFiles = rsFSO
End Function
%>
|
|
|
|
|
|
|
|
|
|
 |
|
|
|
|
<%
dim fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
if request("src")="D" and request("file")<>"" then
response.write server.mappath("mailers\"&request("file"))
set fo=fs.GetFile(server.mappath("mailers\"&request("file")))
fo.Delete(true)
set fo=nothing
end if
%>
<%
set fs=Server.CreateObject("Scripting.FileSystemObject")
Dim strFolder : strFolder = fs.GetFolder(Server.MapPath("sitecms\mailers\"))
Dim rsFSO
'we will exclude all files beginning with a "_"
Set rsFSO = kc_fsoFiles(strFolder, "_")
%>
<%
'ouput the recordset on the page.
i=1
While Not rsFSO.EOF
Response.write("| "&i&" | "&rsFSO("Name").Value&" | ")
i=i+1
rsFso.MoveNext()
Wend
rsFSO.close()
Set rsFSO = Nothing
%>
|
|
|
|
 |
|
 |
|
|
|
| ©
2004 All Rights Reserved. Synergy Unlimited |
|
|