文件。只读。"
End Select
GetAttributes = Str
Else
GetAttributes = -1
End if
End Function
''''最后一次访问/最后一次修改时间
''''Response.Write ShowFileAccessInfo("G: oft\delphi\my_pro\复件 代码库.exe")
Function ShowFileAccessInfo(FileName,InfoType)
''''//功能:显示文件创建时信息
''''//形参:文件名,信息类别
''''// 1 -----创建时间
''''// 2 -----上次访问时间
''''// 3 -----上次修改时间
''''// 4 -----文件路径
''''// 5 -----文件名称
''''// 6 -----文件类型
''''// 7 -----文件大小
''''// 8 -----父目录
''''// 9 -----根目录
''''//返回值:成功为文件创建时信息,失败:-1
''''//
Dim f, s
If ReportFileStatus(FileName) = 1 then
Set f = fso.GetFile(FileName)
Select Case InfoType
Case 1 s = f.DateCreated ''''// 1 -----
创建时间
Case 2 s = f.DateLastAccessed ''''// 2 -----上次访问
时间
Case 3 s = f.DateLastModified ''''// 3 -----上次修改
时间
Case 4 s = f.Path ''''// 4
-----文件路径
Case 5 s = f.Name ''''// 5
-----文件名称
Case 6 s = f.Type ''''// 6
-----文件类型
Case 7 s = f.Size ''''// 7
-----文件大小
Case 8 s = f.ParentFolder ''''// 8 -----
父目录
Case 9 s = f.RootFolder ''''// 8 -----
根目录
End Select
ShowFileAccessInfo = s
ELse
ShowFileAccessInfo = -1
End if
End Function
''''写文本文件
Function WriteTxtFile(FileName,TextStr,WriteORAppendType)
Const ForReading = 1, ForWriting = 2 , ForAppending = 8
Dim f, m
Select Case WriteORAppendType
Case 1: ''''文件进行写操作
Set f = fso.OpenTextFile(FileName, ForWriting, True)
f.Write TextStr
f.Close
If ReportFileStatus(FileName) = 1 then
WriteTxtFile = 1
Else
WriteTxtFile = -1
End if
Case 2: ''''文件末尾进行写操作
If ReportFileStatus(FileName) = 1 then
Set f = fso.OpenTextFile(FileName, ForAppending)
f.Write TextStr
f.Close
WriteTxtFile = 1
Else
WriteTxtFile = -1
End if
End Select
End Function
''''读文本文件
Function ReadTxtFile(FileName)
Const ForReading = 1, ForWriting = 2
Dim f, m
If ReportFileStatus(FileName) = 1 then
Set f = fso.OpenTextFile(FileName, ForReading)
m = f.ReadLine
''''m = f.ReadAll
''''f.SkipLine
ReadTxtFile = m
f.Close
Else
ReadTxtFile = -1
End if
End Function
''''建立文本文件
''''//==================================目录操作==================================
''''取目录大小
Function GetFolderSize(FolderName)
''''//功能:取目录大小
''''//形参:目录名
''''//返回值:成功为目录大小,失败为-1
''''//
Dim f
If ReportFolderStatus(FolderName) = 1 Then
Set f = fso.GetFolder(FolderName)
GetFolderSize = f.Size
Else
GetFolderSize = -1
End if
End Function
''''创建的文件夹
Function CreateFolderDemo(FolderName)
''''//功能:创建的文件夹
''''//形参:目录名
''''//返回值:成功为1,失败为-1
''''//
Dim f
If ReportFolderStatus(Folderspec) = 1 Then
CreateFolderDemo = -1
Else
Set f = fso.CreateFolder(FolderName)
CreateFolderDemo = 1
End if
End Function
''''!!!
''''目录删除
Function DeleteAFolder(Folderspec)
''''//功能:目录删除
''''//形参:目录名
''''//返回值:成功为1,失败为-1
''''//
Response.write Folderspec
If ReportFolderStatus(Folderspec) = 1 Then
fso.DeleteFolder (Folderspec)
DeleteAFolder = 1
Else
DeleteAFolder = -1
End i