《結合FSO操作寫的一個Class》
尚在完善中,基本功能已具備.
也可作為初學者的教程
程序代碼
<%
'***************************** CDS系統 FSO操作類 Beta1 *****************************
'調用方法: Set Obj=New FSOControl
'所有路徑必須為絕對路徑,請采用Server.MapPath方法轉換路徑后再定義變量
'------ FileRun ---------------------------------------
'
'必選參數:
'FilePath ------ 處理文件路徑
'
'可選參數:
'FileAllowType ------ 處理文件允許的類型,定義方法例: gif|jpg|png|txt
'FileNewDir ------ 文件處理后保存到的目錄
'FileNewName ------ 新文件名前綴,請不要添加后綴, 例: sample.txt 則為 sample
'CoverPr ------ 是否覆蓋已有的文件 0為否 1為是 默認為1
'deletePr ------ 是否刪除原文件 0為否 1為是 默認為1
'---------------------------------------------------------
'------ UpDir(path) 取path的父目錄
'path可為文件,也可為目錄
'------ GetPrefixName(path) 取文件名前綴
'path必須為文件,可為完整路徑,也可是單獨文件名
'------ GetFileName(path) 取文件名
'path必須為文件,可為完整路徑,也可是單獨文件名
'------ GetExtensionName(path) 取文件名后綴,不包含"."
'path必須為文件,可為完整路徑,也可是單獨文件名
'------ FileIs(path) path是否為一文件
'如為,返回 true 否則返回 false
'------ FolderCreat(Path)
'------ Folderdelete(Path,FileIF)
'------ FileCopy(Path_From,Path_To,CoverIF)
'------ FileMove(Path_From,Path_To,CoverIF)
'------ Filedelete(Path)
'------ Filerename(OldName,NewName,CoverIf)
Class FSOControl
Dim FSO
Private File_Path,File_AllowType,File_NewFolder_Path,File_NewName,File_CoverIf,File_deleteIf
Public Property Let FilePath(StrType)
File_Path=StrType
End Property
Public Property Let FileAllowType(StrType)
File_AllowType=StrType
End Property
Public Property Let FileNewDir(StrType)
File_NewFolder_Path=StrType
End Property
Public Property Let FileNewName(StrType)
File_NewName=StrType
End Property
Public Property Let CoverPr(LngSize)
If isNumeric(LngSize) then
File_CoverIf=Clng(LngSize)
End If
End Property
Public Property Let deletePr(LngSize)
If isNumeric(LngSize) then
File_deleteIf=Clng(LngSize)
End If
End Property
Private Sub Class_Initialize()
Set FSO=createObject("Scripting.FileSystemObject")