结合FSO操作和Aspjpeg组件写的Class

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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3382.html