久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

服務(wù)器當(dāng)前目錄文件系統(tǒng)信息窺探程序ASP

 昵稱(chēng)19250 2007-02-02
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ FileSystemObject 示例代碼
‘Copyright 2007  獨(dú)孤翼 QQ:88056598   保留所有權(quán)利,。
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Option Explicit
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ 對(duì)于代碼質(zhì)量:
‘ 1) 下面的代碼有許多字符串操作,,用"&"運(yùn)算符來(lái)把短字符串連接在一起,。由于
‘    字符串連接是費(fèi)時(shí)的,,所以這是一種低效率的寫(xiě)代碼方法,。無(wú)論如何,,它是
‘    一種非常好維護(hù)的寫(xiě)代碼方法,,并且在這兒使用了這種方法,,因?yàn)樵摮绦驁?zhí)行
‘    大量的磁盤(pán)操作,而磁盤(pán)操作比連接字符串所需的內(nèi)存操作要慢得多,。
‘    記住這是示范代碼,,而不是產(chǎn)品代碼。

‘ 2) 使用了 "Option Explicit",,因?yàn)樵L(fǎng)問(wèn)聲明過(guò)的變量,,比訪(fǎng)問(wèn)未聲明的變量要
‘    稍微快一些。它還能阻止在代碼中發(fā)生錯(cuò)誤,,例如,,把 DriveTypeCDROM 誤拼
‘    成了 DriveTypeCDORM 。

‘ 3) 為了使代碼更可讀,,該代碼中沒(méi)有錯(cuò)誤處理,。雖然采取了防范措施,來(lái)保證代碼
‘    在普通情況下沒(méi)有錯(cuò)誤,,但文件系統(tǒng)是不可預(yù)知的,。在產(chǎn)品代碼中,使用
‘    On Error Resume Next 和 Err 對(duì)象來(lái)捕獲可能發(fā)生的錯(cuò)誤,。
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Dim TabStop
Dim NewLine
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ 由 File.Attributes 返回的常數(shù)
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Const FileAttrNormal  = 0
Const FileAttrReadOnly = 1
Const FileAttrHidden = 2
Const FileAttrSystem = 4
Const FileAttrVolume = 8
Const FileAttrDirectory = 16
Const FileAttrArchive = 32
Const FileAttrAlias = 64
Const FileAttrCompressed = 128
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ 用來(lái)打開(kāi)文件的常數(shù)
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Const OpenFileForReading = 1
Const OpenFileForWriting = 2
Const OpenFileForAppending = 8
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ ShowFileAttr
‘ 目的:
‘ 生成一個(gè)字符串,來(lái)描述文件或文件夾的屬性,。
‘ 示范下面的內(nèi)容
‘ - File.Attributes
‘ - Folder.Attributes
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Function ShowFileAttr(File) ‘ File 可以是文件或文件夾
   Dim S
   Dim Attr
  
   Attr = File.Attributes
   If Attr = 0 Then
      ShowFileAttr = "Normal"
      Exit Function
   End If
   If Attr And FileAttrDirectory  Then S = S & "Directory "
   If Attr And FileAttrReadOnly   Then S = S & "Read-Only "
   If Attr And FileAttrHidden     Then S = S & "Hidden "
   If Attr And FileAttrSystem     Then S = S & "System "
   If Attr And FileAttrVolume     Then S = S & "Volume "
   If Attr And FileAttrArchive    Then S = S & "Archive "
   If Attr And FileAttrAlias      Then S = S & "Alias "
   If Attr And FileAttrCompressed Then S = S & "Compressed "
   ShowFileAttr = S
End Function

‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ GenerateFileInformation
‘ 目的:
‘ 生成一個(gè)字符串,,來(lái)描述文件的當(dāng)前狀態(tài)。
‘ 示范下面的內(nèi)容
‘  - File.Path
‘  - File.Name
‘  - File.Type
‘  - File.DateCreated
‘  - File.DateLastAccessed
‘  - File.DateLastModified
‘  - File.Size
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Function GenerateFileInformation(File)
   Dim S
   S = NewLine & "Path:" & TabStop & File.Path
   S = S & NewLine & "Name:" & TabStop & File.Name
   S = S & NewLine & "Type:" & TabStop & File.Type
   S = S & NewLine & "Attribs:" & TabStop & ShowFileAttr(File)
   S = S & NewLine & "Created:" & TabStop & File.DateCreated
   S = S & NewLine & "Accessed:" & TabStop & File.DateLastAccessed
   S = S & NewLine & "Modified:" & TabStop & File.DateLastModified
   S = S & NewLine & "Size" & TabStop & File.Size & NewLine
   GenerateFileInformation = S
End Function
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ GenerateFolderInformation
‘ 目的:
‘ 生成一個(gè)字符串,,來(lái)描述文件夾的當(dāng)前狀態(tài),。
‘ 示范下面的內(nèi)容
‘  - Folder.Path
‘  - Folder.Name
‘  - Folder.DateCreated
‘  - Folder.DateLastAccessed
‘  - Folder.DateLastModified
‘  - Folder.Size
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Function GenerateFolderInformation(Folder)
   Dim S
   S = "Path:" & TabStop & Folder.Path
   S = S & NewLine & "Name:" & TabStop & Folder.Name
   S = S & NewLine & "Attribs:" & TabStop & ShowFileAttr(Folder)
   S = S & NewLine & "Created:" & TabStop & Folder.DateCreated
   S = S & NewLine & "Accessed:" & TabStop & Folder.DateLastAccessed
   S = S & NewLine & "Modified:" & TabStop & Folder.DateLastModified
   S = S & NewLine & "Size:" & TabStop & Folder.Size & NewLine
   GenerateFolderInformation = S
End Function
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
‘ GenerateAllFolderInformation
‘ 目的:
‘ 生成一個(gè)字符串,來(lái)描述一個(gè)文件夾和所有文件及子文件夾的當(dāng)前狀態(tài),。
‘ 示范下面的內(nèi)容
‘  - Folder.Path
‘  - Folder.SubFolders
‘  - Folders.Count
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
Function GenerateAllFolderInformation(Folder)
   Dim S
   Dim SubFolders
   Dim SubFolder
   Dim Files
   Dim File
   S = "Folder:" & TabStop & Folder.Path & NewLine & NewLine
   Set Files = Folder.Files
   If 1 = Files.Count Then
      S = S & "There is 1 file" & NewLine
   Else
      S = S & "There are " & Files.Count & " files" & NewLine
   End If
   If Files.Count <> 0 Then
      For Each File In Files
         S = S & GenerateFileInformation(File)
      Next
   End If
   Set SubFolders = Folder.SubFolders
   If 1 = SubFolders.Count Then
      S = S & NewLine & "There is 1 sub folder" & NewLine & NewLine
   Else
      S = S & NewLine & "There are " & SubFolders.Count & " sub folders" & NewLine & NewLine
   End If
   If SubFolders.Count <> 0 Then
      For Each SubFolder In SubFolders
         S = S & GenerateFolderInformation(SubFolder)
      Next
      S = S & NewLine
      For Each SubFolder In SubFolders
         S = S & GenerateAllFolderInformation(SubFolder)
      Next
   End If
   GenerateAllFolderInformation = S
End Function

Sub Main  
   ‘ 設(shè)立全局變量,。
TabStop = " "‘Chr(9)
NewLine = "<br>"‘Chr(10)

Dim objFolder
Dim objFSO
‘ 建立FSO和文件夾對(duì)象
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath("."))  ‘獲取當(dāng)前目錄路徑
Response.Write GenerateFolderInformation(objFolder)&"<br>"
Response.Write GenerateAllFolderInformation(objFolder)
End Sub
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www./1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文件系統(tǒng)信息表</title>
</head>
<body>
<%
Main
%>
</body>
</html>

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多