文件管理

Sub Sure_Click()
        Dim PathString As String
        Dim DirObj As DirectoryInfo
        Dim thepath As String
        thepath = Server.MapPath("/Weboffice/fluxayadmin/youxi/images")
        If Request.QueryString.Get("dir") = "" Then
            PathString = thepath.ToString()
        Else
            PathString = Request.QueryString.Get("dir")
        End If
        DirObj = New System.IO.DirectoryInfo(PathString)
        If DirObj.Exists = False Then
            Response.Write("该文件夹不存在!")
        Else
            DispInfo(PathString)
        End If
    End Sub
    Sub DispInfo(ByVal PathStr As String)
        Dim DirObj As DirectoryInfo
        Dim Arrstr() As DirectoryInfo
        Dim Arrstr1() As FileInfo
        Dim i As Integer
        DirObj = New System.IO.DirectoryInfo(PathStr)
        Response.Write("查看图片文件夹的全部内容")
        Response.Write("点击可以查看图片")
        Response.Write("<p>你现在浏览的目录是:<b>")
        Response.Write(DirObj.FullName.ToString())
        Response.Write("</b></p>")
        Response.Write("该目录创建时间为:<b>")
        Response.Write(DirObj.CreationTime.ToString() & "</b>")
        Response.Write("&nbsp;&nbsp;最后修改时间为:<b>")
        Response.Write(DirObj.LastWriteTime.ToString())
        Response.Write("</b></p>")
        Response.Write("图片文件包括:</p>")
        Response.Write("<table border=0 width=90%>")
        Response.Write("<tr height=30><th width=20%><small>名称</small></th>")
        Response.Write("<th width=15%><small>大小</small></th>")
        Response.Write("<th width=15%><small>类型</small></th>")
        Response.Write("<th width=20%><small>创建时间</small></th>")
        Response.Write("<th width=20%><small>最后修改时间</small></th>")
        Response.Write("<th width=10% align='center'>是否删除</th><tr>")

        Arrstr1 = DirObj.GetFiles()
        For i = 0 To Arrstr1.Length - 1
            Response.Write("<tr>")
            Response.Write("<td><a href='images/")
            Response.Write(Arrstr1(i).Name)
            Response.Write("' target='_blank'>" & Arrstr1(i).Name)
            Response.Write("</a></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).Length & "字节</small></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).Extension & "</small></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).CreationTime.ToString() & "</small></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).LastWriteTime.ToString() & "</small></td>")
            Response.Write("<td><a href='delpicch.aspx?dir=")
            Response.Write(Arrstr1(i).FullName)
            Response.Write("'>")
            Response.Write("删除")
            Response.Write("</a></td>")
            Response.Write("</tr>")
        Next
        Response.Write("</table>")
    End Sub

   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        check()
        Dim path As String
        path = Request.QueryString.Get("dir")
        File.Delete(path)
        Response.Write("<script>alert('删除成功');window.location.href='delpic.aspx'</script>")
    End Sub

阅读更多
想对作者说点什么? 我来说一句

操作系统文件管理实验报告

2015年05月18日 1.39MB 下载

文 件 管 理

2007年09月01日 221KB 下载

没有更多推荐了,返回首页

不良信息举报

文件管理

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭