'原来用VB写的封装成dll供asp使用,后来升级到vb.net
'这个是我以前写的电影站影片处理的一部份,程序挺简单的,没怎么注释,大家对付看
'program by someeyes
'需要声明Imports System.IO命名空间
Public Function myFileExists(ByVal pathName As String) As String '检查文件是否存在
If File.Exists(pathName) = False Then
myFileExists = "<font color=""Red"">文件丢失</font>"
Else
myFileExists = "<font color=""#0066ff"">文件存在</font>"
End If
End Function
Private sub myCreatDirectory(ByVal pathName As String) '创建文件夹
Try
If Directory.Exists(pathName) = False Then
Directory.CreateDirectory(pathName)
End If
Catch e As Exception
myErrMsg = myErrMsg & "创建" & pathName & "文件夹的时候出现一个意外的错误."
myErrMsg = myErrMsg & e.ToString
HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")
End Try
End Sub
Private Sub myDelDirectory(ByVal pathName As String) '删除文件夹
Try
If Directory.Exists(pathName) = True Then
Directory.Delete(pathName)
End If
Catch e As Exception
myErrMsg = myErrMsg & "删除" & pathName & "文件夹的时候出现一个意外的错误."
myErrMsg = myErrMsg & e.ToString
HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")
End Try
End Sub
Private Sub myMoveFile(ByVal pathName As String, ByVal target As String) '移动文件夹
Try
File.Move(pathName, target)
Catch e As Exception
myErrMsg = myErrMsg & "从" & pathName & "移动文件到" & target & "的时候出现一个意外的错误."
myErrMsg = myErrMsg & e.ToString
HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")
End Try
End Sub
Private Sub myCopyFile(ByVal fsource As String, ByVal fdestination As String)
Try
File.Copy(fsource, fdestination, False)
Catch e As Exception
myErrMsg = myErrMsg & "从" & fsource & "复制文件到" & fdestination & "的时候出现一个意外的错误."
myErrMsg = myErrMsg & e.ToString
HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")
End Try
End Sub