结合FSO操作和Aspjpeg组件写的Class(3)
Public Function FolderCreat(Path)
If fso.FolderExists(Path) then
FolderCreat="指定要创建目录已存在"
Exit Function
ElseIf Not(fso.FolderExists(UpDir(Path))) then
FolderCreat="指定要创建的目录路径错误"
Exit Function
End If
fso.createFolder(Path)
FolderCreat=True
End Function
Public Function Folderdelete(Path,FileIF)
If Not(fso.FolderExists(Path)) then
Folderdelete="指定要删除的目录不存在"
Exit Function
End If
If FileIF=1 then
Set FsoFile = Fso.GetFolder(Path)
If(FsoFile.SubFolders.count>0 or FsoFile.Files.count>0) then
Set FsoFile=Nothing
Folderdelete="只要要删除的目录下含有文件或子目录,不允许删除"
Exit Function
End If
Set FsoFile=Nothing
End If
Fso.deleteFolder(Path)
Folderdelete=True
End Function
Public Function FileCopy(Path_From,Path_To,CoverIF)
If Not(fso.FileExists(Path_From)) then
FileCopy="指定要复制的文件不存在"
Exit Function
ElseIf Not(fso.FolderExists(UpDir(Path_To))) then
FileCopy="指定要复制到的目录不存在"
Exit Function
End If
If CoverIF=0 and fso.FileExists(Path_To) then
FileCopy="指定要复制到的目录下已存在相同名称文件,不允许覆盖"
Exit Function
End If
fso.CopyFile Path_From,Path_To
FileCopy=True
End Function
Public Function FileMove(Path_From,Path_To,CoverIF)
If Not(fso.FileExists(Path_From)) then
FileMove="指定要移动的文件不存在"
Exit Function
ElseIf Not(fso.FolderExists(UpDir(Path_To))) then
FileMove="指定要移动到的目录不存在"
Exit Function
End If
If fso.FileExists(Path_To) then
If CoverIF=0 then
FileMove="指定要移动到的目录下已存在相同名称文件,不允许覆盖"
Exit Function
Else
Call Filedelete(Path_To)
End If
End If
fso.MoveFile Path_From,Path_To
FileMove=True
End Function
Public Function Filedelete(Path)
If Not(fso.FileExists(Path)) then
Filedelete="指定要删除的文件不存在"
Exit Function
End If
Fso.deleteFile Path
Filedelete=True
End Function
Public Function Filerename(OldName,NewName,CoverIf)
NewName=NewName&"."&GetExtensionName(OldName)
If GetFileName(OldName)=NewName then
Filerename="更改前的文件与更改后的文件名称相同"
Exit Function
ElseIf Not(fso.FileExists(OldName)) then
Filerename="指定更改名称的文件不存在"
Exit Function
ElseIf fso.FileExists(UpDir(OldName)&"\"&NewName) then
If CoverIf=0 then
内容版权声明:除非注明,否则皆为本站原创文章。