'这个是我以前写的电影站影片处理的一部份,程序挺简单的,没怎么注释,大家对付看
'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
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!