欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

結合FSO操作寫的一個Class

系統 1657 0
結合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")
File_Path=""
File_AllowType="gif|jpg|png|txt"
File_NewFolder_Path=""
File_NewName=""
File_CoverIf=1
File_deleteIf=0
EndSub
PrivateSubClass_Terminate()
Err.Clear
SetFSO=Nothing
EndSub


PublicFunctionUpDir(ByValD)
IfLen(D)=0then
UpDir=""
Else
UpDir=Left(D,InStrRev(D,"\")-1)
EndIf
EndFunction
PublicFunctionGetPrefixName(ByValD)
IfLen(D)=0then
GetPrefixName=""
Else
FileName=GetFileName(D)
GetPrefixName=Left(FileName,InStrRev(FileName,".")-1)
EndIf
EndFunction
PublicFunctionGetFileName(name)
FileName=Split(name,"\")
GetFileName=FileName(Ubound(FileName))
EndFunction
PublicFunctionGetExtensionName(name)
FileName=Split(name,".")
GetExtensionName=FileName(Ubound(FileName))
EndFunction
PublicFunctionFileIs(Path)
Iffso.FileExists(Path)then
FileIs=true
Else
FileIs=false
EndIf
EndFunction

PublicFunctionFileOpen(Path,NewFile,ReadAction,LineCount)
IfFileIs(Path)=Falsethen
IfNewFile<>1then
FileOpen=False
ElseIfFolderIs(UpDir(Path))=Falsethen
FileOpen=False
ExitFunction
Else
fso.OpenTextFilePath,1,True
FileOpen=""
EndIf
ExitFunction
EndIf
SetFileOption=fso.GetFile(Path)
IfFileOption.size=0then
SetFileOption=Nothing
FileOpen=""
ExitFunction
EndIf
SetFileOption=Nothing
SetFileText=fso.OpenTextFile(Path,1)
IfIsNumeric(ReadAction)then
FileOpen=FileText.Read(ReadAction)
ElseIfUcase(ReadAction)="ALL"then
FileOpen=FileText.ReadAll()
ElseIfUcase(ReadAction)="LINE"then
IfNot(IsNumeric(LineCount))orLineCount=0then
FileOpen=False
SetFileText=Nothing
ExitFunction
Else
i=0
DoWhileNotFileText.AtEndOfStream
FileOpen=FileOpen&FileText.ReadLine
i=i+1
Ifi=LineCountthenExitDo
Loop
EndIf
EndIf
SetFileText=Nothing
EndFunction

PublicFunctionFileWrite(Path,WriteStr,NewFile)
IfFolderIs(UpDir(Path))=Falsethen
FileWrite=False
ExitFunction
ElseIfFileIs(Path)=FalseandNewFile<>1then
FileWrite=False
ExitFunction
EndIf
SetFileText=fso.OpenTextFile(Path,2,True)
FileText.WriteWriteStr
SetFileText=Nothing
FileWrite=True
EndFunction

PublicFunctionFolderIs(Path)
Iffso.FolderExists(Path)then
FolderIs=true
Else
FolderIs=false
EndIf
EndFunction
PublicFunctionFolderCreat(Path)
Iffso.FolderExists(Path)then
FolderCreat="指定要創建目錄已存在"
ExitFunction
ElseIfNot(fso.FolderExists(UpDir(Path)))then
FolderCreat="指定要創建的目錄路徑錯誤"
ExitFunction
EndIf
fso.createFolder(Path)
FolderCreat=True
EndFunction
PublicFunctionFolderdelete(Path,FileIF)
IfNot(fso.FolderExists(Path))then
Folderdelete="指定要刪除的目錄不存在"
ExitFunction
EndIf
IfFileIF=1then
SetFsoFile=Fso.GetFolder(Path)
If(FsoFile.SubFolders.count>0orFsoFile.Files.count>0)then
SetFsoFile=Nothing
Folderdelete="只要要刪除的目錄下含有文件或子目錄,不允許刪除"
ExitFunction
EndIf
SetFsoFile=Nothing
EndIf
Fso.deleteFolder(Path)
Folderdelete=True
EndFunction
PublicFunctionFileCopy(Path_From,Path_To,CoverIF)
IfNot(fso.FileExists(Path_From))then
FileCopy="指定要復制的文件不存在"
ExitFunction
ElseIfNot(fso.FolderExists(UpDir(Path_To)))then
FileCopy="指定要復制到的目錄不存在"
ExitFunction
EndIf
IfCoverIF=0andfso.FileExists(Path_To)then
FileCopy="指定要復制到的目錄下已存在相同名稱文件,不允許覆蓋"
ExitFunction
EndIf
fso.CopyFilePath_From,Path_To
FileCopy=True
EndFunction
PublicFunctionFileMove(Path_From,Path_To,CoverIF)
IfNot(fso.FileExists(Path_From))then
FileMove="指定要移動的文件不存在"
ExitFunction
ElseIfNot(fso.FolderExists(UpDir(Path_To)))then
FileMove="指定要移動到的目錄不存在"
ExitFunction
EndIf
Iffso.FileExists(Path_To)then
IfCoverIF=0then
FileMove="指定要移動到的目錄下已存在相同名稱文件,不允許覆蓋"
ExitFunction
Else
CallFiledelete(Path_To)
EndIf
EndIf
fso.MoveFilePath_From,Path_To
FileMove=True
EndFunction
PublicFunctionFiledelete(Path)
IfNot(fso.FileExists(Path))then
Filedelete="指定要刪除的文件不存在"
ExitFunction
EndIf
Fso.deleteFilePath
Filedelete=True
EndFunction
PublicFunctionFilerename(OldName,NewName,CoverIf)
NewName=NewName&"."&GetExtensionName(OldName)
IfGetFileName(OldName)=NewNamethen
Filerename="更改前的文件與更改后的文件名稱相同"
ExitFunction
ElseIfNot(fso.FileExists(OldName))then
Filerename="指定更改名稱的文件不存在"
ExitFunction
ElseIffso.FileExists(UpDir(OldName)&"\"&NewName)then
IfCoverIf=0then
Filerename="目錄下已存在與更改后的文件名稱相同的文件,不允許覆蓋"
ExitFunction
Else
CallFiledelete(UpDir(OldName)&"\"&NewName)
EndIf
EndIf
SetFsoFile=fso.GetFile(OldName)
FsoFile.Name=NewName
SetFsoFile=Nothing
Filerename=True
EndFunction

PublicFunctionFileRun()
IfFile_NewFolder_Path=""andFile_NewName=""then
FileRun="此操作執行后并未對指定文件產生變動,系統自動中止"
ExitFunction
ElseIfFile_Path=""orNot(fso.FileExists(File_Path))then
FileRun="要進行操作的文件不存在"
ExitFunction
ElseIfInstr(File_AllowType,GetExtensionName(File_Path))=0then
FileRun="要進行操作的文件被系統拒絕,允許的格式為:"&Replace(File_AllowType,"|","")
ExitFunction
EndIf

IfFile_NewFolder_Path=""then
File_NewFolder_Path=UpDir(File_Path)
ElseIfNot(fso.FolderExists(File_NewFolder_Path))then
FileRun="指定要移動到的目錄不存在"
ExitFunction
EndIf
IfRight(File_NewFolder_Path,1)<>"\"thenFile_NewFolder_Path=File_NewFolder_Path&"\"
IfFile_NewName=""then
File_NewPath=File_NewFolder_Path&GetFileName(File_Path)
Else
File_NewPath=File_NewFolder_Path&File_NewName&"."&GetExtensionName(File_Path)
EndIf
IfFile_Path=File_NewPaththen
FileRun="此操作執行后并未對指定文件產生變動,系統自動中止"
ExitFunction
ElseIfUpDir(File_Path)<>UpDir(File_NewPath)then
IfFile_deleteIf=1then
CallFileMove(File_Path,File_NewPath,File_CoverIf)
Else
CallFileCopy(File_Path,File_NewPath,File_CoverIf)
EndIf
FileRun=True
Else
'IfFile_deleteIf=1then
CallFilerename(File_Path,GetPrefixName(File_NewPath),File_CoverIf)
'Else
'CallFileCopy(File_Path,File_NewPath,File_CoverIf)
'EndIf
FileRun=True
EndIf
EndFunction
EndClass
%>
轉自 落伍者 原作者:tonycc

google_ad_client = "pub-2416224910262877"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_channel = ""; google_color_border = "FFFFFF"; google_color_bg = "FFFFFF"; google_color_link = "0000FF"; google_color_text = "000000"; google_color_url = "008000";

結合FSO操作寫的一個Class


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 日韩精品成人a在线观看 | 成人高清在线视频 | 日韩久草 | 97久久精品人人做人人爽50路 | 三级国产视频 | 日韩精品真人荷官无码 | 免费一区二区三区免费视频 | 99久久99久久精品免费看蜜桃 | 91免费观看| 免费在线毛片 | 四虎欧美在线观看免费 | 日韩美女一区二区三区在线观看 | 婷婷免费视频 | 草久网 | 日韩精品区 | 久久天天躁夜夜躁狠狠 | 久操中文在线 | 国产一区二区黑人欧美xxxx | 一级毛片免费播放 | 色先锋av资源中文字幕 | 久久中文字幕美谷朱里 | 日本久久久久中文字幕 | 欧美日韩综合在线视频免费看 | 91tv在线观看 | 亚洲 欧美 日韩 在线 | wwwbnb89 | 综合久久久久综合 | 波多野结衣在线网站 | 色婷婷综合久久久久中文 | 成人小视频在线观看免费 | 小明成人免费视频 | 一级黄色大全 | 亚洲免费在线播放 | 日本理伦片午夜理伦片 | 波多野结衣三区 | 99爱在线观看 | 青青草一区 | 国产乱码一区二区三区 | 青青久草| 国产精品揄拍一区二区久久 | 久久精品国产一区二区三区不卡 |