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

<%
function listProp(obj, objName) {
      for (var i in obj)
           Response.write(objName+".<font color=red>"+i+"</font> = <font color=green>"+obj[i]+"</font><br>\n");
}

// 列印字典變數
function listDict(dict, dictName){
      temp=new VBArray(dict.Keys());
      allKeys = temp.toArray(); // 取出鍵值
      for (var i=0; i<dict.Count; i++)
           Response.write(dictName+"(\"<font color=blue>"+allKeys[i]+"</font>\") = <font color=red>"+dict(allKeys[i])+"</font><br>\n");
}

fso = Server.CreateObject("Scripting.FileSystemObject");
absPath = Request.ServerVariables("PATH_TRANSLATED");
file = fso.GetFile(absPath);
Response.write("typeof(file)="+typeof(file)+"<br>");
%>

<h3 align=center>file = <%=file%></h3>
<%listProp(file, "file");%>
<hr>
<!--#include file="../foot.inc"-->