《結合FSO操作寫的一個Class》
尚在完善中,基本功能已具備.
也可作為初學者的教程
程序代碼
<%
'*****************************CDS系統FSO操作類Beta1*****************************
'調用方法:SetObj=NewFSOControl
'所有路徑必須為絕對路徑,請採用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)
ClassFSOControl
DimFSO
PrivateFile_Path,File_AllowType,File_NewFolder_Path,File_NewName,File_CoverIf,File_deleteIf
PublicPropertyLetFilePath(StrType)
File_Path=StrType
EndProperty
PublicPropertyLetFileAllowType(StrType)
File_AllowType=StrType
EndProperty
PublicPropertyLetFileNewDir(StrType)
File_NewFolder_Path=StrType
EndProperty
PublicPropertyLetFileNewName(StrType)
File_NewName=StrType
EndProperty
PublicPropertyLetCoverPr(LngSize)
IfisNumeric(LngSize)then
File_CoverIf=Clng(LngSize)
EndIf
EndProperty
PublicPropertyLetdeletePr(LngSize)
IfisNumeric(LngSize)then
File_deleteIf=Clng(LngSize)
EndIf
EndProperty
PrivateSubClass_Initialize()
SetFSO=createObject("Scripting.FileSystemObject")