"A Class written in combination with FSO operations"
It is still being improved and the basic functions are already in place.
It can also be used as a tutorial for beginners
Program code
<%
'************************************CDS system FSO operation class Beta1************************
'Call method:SetObj=NewFSOControl
'All paths must be absolute paths. Please use the Server.MapPath method to convert the path before defining the variables
'------FileRun---------------------------------------
'
'Required parameters:
'FilePath-----process file path
'
'Optional parameters:
'FileAllowType--------process the file's allowed types, define method example: gif|jpg|png|txt
'FileNewDir--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'FileNewName--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'CoverPr------- Whether to overwrite existing files 0 is no 1 is yes default is 1
'deletePr------ Whether to delete the original file 0 is no 1 is yes default is 1
'---------------------------------------------------------
'-------UpDir(path) takes the parent directory of path
'path can be a file or a directory
'------- GetPrefixName(path) prefix the file name
'path must be a file, can be a full path, or a separate file name
'------ GetFileName(path) to get the file name
'path must be a file, can be a full path, or a separate file name
'------GetExtensionName(path) takes the file name suffix, does not contain "."
'path must be a file, can be a full path, or a separate file name
'------ Is FileIs(path)path a file
'If so, return true otherwise return 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")