分类: WINDOWS
2007-10-22 17:07:06
'判断文件名windows下的目录名是否合法
Function IsValidWindowsFolderName(strFolderName)
IsValidWindowsFolderName=TRUE
sErrorStr=Array("/","\",":","*","?","""","<",">","|")
iNameLength=Len(strFolderName)
'判断目录长度是否合法
If iNameLength<1 or iNameLength=null or iNameLength>255 Then
IsValidWindowsFolderName=FALSE
Else
'判断目录名字中是否有非法字符
For i=0 To 8
If instr(strFolderName,sErrorStr(i)) Then
IsValidWindowsFolderName=FALSE
exit Function
End If
Next
End If
End Function
'判断文件名windows下的文件名是否合法
Function IsValidWindowsFileName(strFileName)
IsValidWindowsFileName=TRUE
sErrorStr=Array("/","\",":","*","?","""","<",">","|")
iNameLength=Len(strFileName)
If iNameLength<1 or iNameLength=null or iNameLength>255 Then
response.Write("")
response.End()
IsValidWindowsFileName=FALSE
Else
if instr(strFileName,".htm")>0 or instr(strFileName,".html")>0 or instr(strFileName,".asp")>0 or instr(strFileName,".shtml")>0 then
For i=0 To 8
If instr(strFileName,sErrorStr(i)) Then
response.Write("")
不能采集本站
'*******************************************
'函数作用:取得文件的后缀名
'*******************************************
Function GetExtensionName(name)
Dim ArrayFileName
ArrayFileName=Split(name,".")
GetExtensionName=ArrayFileName(Ubound(ArrayFileName))
End Function
'*******************************************
'函数作用:格式化文件的大小
'*******************************************
Function GetFileSize(size)
Dim FileSize
FileSize=size / 1024
FileSize=FormatNumber(FileSize,2)
If FileSize < 1024 and FileSize > 1 then
GetFileSize=""& FileSize & " KB"
ElseIf FileSize >1024 then
GetFileSize=""& FormatNumber(FileSize / 1024,2) & " MB"
Else
GetFileSize=""& Size & " Bytes"
End If
End Function
'*******************************************
'函数作用:格式化文件属性
'*******************************************
Function GetFileAttr(AttributesNo)
Dim AttributesName
Select Case AttributesNo
编程大本营
编程大本营