'原來用VB寫的封裝成dll供asp使用,後來升級到vb.net
'這個是我以前寫的電影站影片處理的一部份,程序挺簡單的,沒怎麼註釋,大家對付看
'programbysomeeyes
'需要聲明ImportsSystem.IO命名空間
PublicFunctionmyFileExists(ByValpathNameAsString)AsString'檢查文件是否存在
IfFile.Exists(pathName)=FalseThen
myFileExists="<fontcolor=""Red"">文件丟失</font>"
Else
myFileExists="<fontcolor=""#0066ff"">文件存在</font>"
EndIf
EndFunction
PrivatesubmyCreatDirectory(ByValpathNameAsString)'創建文件夾
Try
IfDirectory.Exists(pathName)=FalseThen
Directory.CreateDirectory(pathName)
EndIf
CatcheAsException
myErrMsg=myErrMsg&"創建"&pathName&"文件夾的時候出現一個意外的錯誤."
myErrMsg=myErrMsg&e.ToString
HttpContext.Current.Response.Write("程序遇到一個意外的錯誤,詳細情況請查看日誌文件!<br>")
EndTry
EndSub
PrivateSubmyDelDirectory(ByValpathNameAsString)'刪除文件夾
Try
IfDirectory.Exists(pathName)=TrueThen
Directory.Delete(pathName)
EndIf
CatcheAsException
myErrMsg=myErrMsg&"刪除"&pathName&"文件夾的時候出現一個意外的錯誤."