《结合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")