View Source
Go Back to /jang/books/asp/example/fileAccess/folderProp01.asp
<%@language=JScript%>
<%  title="列出資料夾的屬性" %>
<!--#include file="../head.inc"-->
<hr>

<%
// Reference: http://www.ezineasp.net/post/Javascript-FSO-GetFolder-Method.aspx
fso = Server.CreateObject("Scripting.FileSystemObject");
fileName = Request.ServerVariables("SCRIPT_NAME");
absPath = Server.MapPath(fileName);
parentFolder = fso.GetParentFolderName(absPath);
folder = fso.GetFolder(parentFolder);
methods = [
      "Attributes",
      "DateCreated",
      "DateLastAccessed",
      "DateLastModified",
      "Drive",
      "IsRootFolder",
      "Name",
      "ParentFolder",
      "Path",
      "ShortName",
      "ShortPath",
      "Size",
      "Type"];
%>

<h3 align=center>folder = <%=folder%></h3>
<table border=1 align=center>
<%  for (i=0; i<methods.length; i++){
      cmd = "folder." + methods[i]; %>

      <tr><td><%=cmd%><td> <font color=green><%=eval(cmd)%></font>
<%}%>
</table>

<hr>
<!--#include file="../foot.inc"-->