欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp fso操作类

程序员文章站 2022-03-14 10:50:59
复制代码 代码如下:<% '================================================================ '=&n...
复制代码 代码如下:

<%
'================================================================
'=                    系统版本:1.0                                =
'=                    文件版本:1.0                                =
'=                文本创建日期:2005-10-31                        =
'================================================================
class cls_io
    private filesystemobject

    private sub class_terminate()
        if isobject(filesystemobject) then
            set filesystemobject = nothing
        end if
    end sub

    '//创建filesystemobject对象
    public function init_object()
        on error resume next
        if not isobject(filesystemobject) then
            set filesystemobject = server.createobject("scripting.filesystemobject")
            if err.number <> 0 then
                init_object = false
                err.clear
                exit function
            else
                init_object = true
            end if
        end if
    end function

    public sub deletefile(byval str)
        on error resume next
        call filesystemobject.deletefile(server.mappath("../uploadfile/"&str))
    end sub

    public function isfolder(byval str)
        isfolder = filesystemobject.folderexists(str)
    end function

    
    public function showfolder(byval str)
        dim obj_folder,obj_file
        set obj_folder = filesystemobject.getfolder(server.mappath(str))
        set showfolder = obj_folder.files
        set obj_folder = nothing
    end function

end class
%>