home *** CD-ROM | disk | FTP | other *** search
- <!--
-
- ASP FileFunctions Demo by J. Ritmeijer
- For more info check out http://wwww.xs4all.nl/~jarit/asp/
-
- -->
-
-
- <%
- sub PrintList()
- Sort = Request("sort")
- Order = Request("order")
- if Sort <> "" then
- FFunc.sort Sort,Order
- end if
-
- response.write("<TABLE WIDTH='100%' BORDER=1 CELLPADDING=4 CELLSPACING=0 BGCOLOR='white' BORDERCOLOR='black'>")
- response.write("<TR BGCOLOR='#cc6666'><TD><B>Path</B></TD>")
- response.write("<TD><B>Filename</B></TD>")
- response.write("<TD ALIGN='right'><B>Size</B></TD>")
- response.write("<TD><B>Modified date</B></TD>")
- response.write("<TD><B>Attributes</B></TD></TR>")
- s = ""
- For i = 1 to ffunc.count
- response.write("<TR VALIGN='TOP'><TD WIDTH='15%'>" & FFunc(i).Path & " </TD>")
- response.write("<TD WIDTH='30%'>" & FFunc(i).name & " </TD>")
- response.write("<TD WIDTH='15%' ALIGN='right'>" & formatnumber(FFunc(i).Size,false,true) & " </TD>")
- response.write("<TD WIDTH='30%'>" & FFunc(i).Modified & " </TD>")
- response.write("<TD WIDTH='10%'>" & FFunc(i).Attributes & " </TD></TR>")
- Next
- response.write "</TABLE><P>"
- end sub
- %>
-
- <HTML>
- <HEAD>
- <TITLE>ASP Filefunctions Demo</TITLE>
- </HEAD>
-
- <BODY BGCOLOR="#ffffcc">
-
-
- <H1>FileFunctions Demo</H1>
-
- <B>Sort ascending on:</B>
- <A HREF="filefunc.asp?sort=path&order=ascending">Path</A>,
- <A HREF="filefunc.asp?sort=name&order=ascending">Name</A>,
- <A HREF="filefunc.asp?sort=extension&order=ascending">Extension</A>,
- <A HREF="filefunc.asp?sort=size&order=ascending">Size</A>,
- <A HREF="filefunc.asp?sort=modified&order=ascending">Modified</A>,
- <A HREF="filefunc.asp?sort=attributes&order=ascending">Attributes</A>
- <BR>
- <B>Sort descending on:</B>
- <A HREF="filefunc.asp?sort=path&order=descending">Path</A>,
- <A HREF="filefunc.asp?sort=name&order=descending">Name</A>,
- <A HREF="filefunc.asp?sort=extension&order=descending">Extension</A>,
- <A HREF="filefunc.asp?sort=size&order=descending">Size</A>,
- <A HREF="filefunc.asp?sort=modified&order=descending">Modified</A>,
- <A HREF="filefunc.asp?sort=attributes&order=descending">Attributes</A>
- <BR>
-
- <P><B><I>Display all directories in c:\</I></B><P>
- <%
- set FFunc = Server.createobject("Filefunctions.files")
-
-
- ' FFunc.Path = "\\onyx\data" ' UNC paths are allowed
- FFunc.path = "c:\"
- FFunc.mask = "*.*"
- FFunc.attributes = 16 ' get only directories
- FFunc.GetFileList()
- PrintList
- %>
-
- <HR>
-
- <P><B><I>Display all system files in c:\</I></B><P>
- <%
- FFunc.clearfilelist
- FFunc.attributes = 4
- FFunc.GetFileList("c:\*.*")
- PrintList
- %>
-
- <HR>
-
- <B><I>Make Directory c:\ffuncdir</I></B><P>
-
- <% FFunc.MakeDir("c:\ffuncdir")
- FFunc.clearfilelist
- FFunc.attributes = 16
- FFunc.path = "c:\"
- FFunc.mask = "f*"
- FFunc.GetFileList
- PrintList
- %>
-
- <HR>
-
- <B><I>Rename Directory c:\ffuncdir into c:\ffunc</I></B><P>
-
- <% FFunc.Rename "c:\ffuncdir","c:\ffunc"
- FFunc.clearfilelist
- FFunc.GetFileList
- PrintList
- %>
-
- <HR>
-
- <B><I>move directory c:\ffunc to c:\f\ffunc</I></B><P>
-
- <% FFunc.MakeDir("c:\f")
- FFunc.Rename "c:\ffunc","c:\f\ffunc"
- FFunc.Path = "c:\f"
- FFunc.clearfilelist
- FFunc.GetFileList
- PrintList
- %>
-
- <HR>
-
- <B><I>remove directory c:\f</I></B><P>
-
- <% FFunc.removeDir("c:\f\ffunc")
- FFunc.removeDir("c:\f")
- FFunc.clearfilelist
- FFunc.Path = "c:\"
- FFunc.GetFileList
- PrintList
- %>
-
- <HR>
-
- <B><I>Uncomment source code for killfile demo</I></B><P>
-
- <% ' since I don't want to erase your harddisk, uncomment and adapt the following line
- ' for an example that erases all files and empty directories for a given path.
- 'FFunc.clearfilelist
- 'FFunc.attributes = -1
- 'FFunc.getfilelist("e:\test\*.*")
- 'PrintList
- 'For each file in ffunc
- ' if not file.killfile then
- ' response.write file.lasterror
- ' end if
- 'next
- 'FFunc.Clearfilelist
- 'FFunc.getfilelist("e:\test\*.*")
- 'PrintList
- %>
-
- <HR>
-
- <B><I>Check for c:\autoexec.bat</I></B><P>
- <% ffunc.path = "c:\"
- ffunc.mask = "autoexec.bat"
- if FFunc.Exists() then
- response.write("<P>exists")
- else
- response.write("<P>does not exist")
- end if
- %>
-
- <HR>
-
- <B><I>Check for c:\heyyou.txt</I></B><P>
- <% if FFunc.Exists("c:\heyyou.txt") then
- response.write("<P>exists")
- else
- response.write("<P>does not exist")
- end if
- %>
-
- <HR>
-
- <P>
-
- For more info check out the <A HREF="http://www.xs4all.nl/~jarit/asp/">support site</A>.
-
- </BODY>
- </HTML>
-