当前位置: 网学 > 编程文档 > ASP > 正文

Asp中一些FSO方面的函数

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/17
下载{$ArticleTitle}原创论文样式
pec
If ReportFolderStatus(Folderspec) = 1 Then
fso.deleteFolder (Folderspec)
deleteAFolder = 1
Else
deleteAFolder = -1
End if
End Function

''''显示目录列表
Function ShowFolderList(folderspec)
''''//功能:目录存在时显示此目录下的所有子目录
''''//形参:目录名
''''//返回值:成功为子目录列表,失败为-1
''''//
Dim f, f1, fc, s
If ReportFolderStatus(folderspec) = 1 Then
Set f = fso.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
s = s & f1.name
s = s & "|"
Next
ShowFolderList = s
Else
ShowFolderList = -1
End if
End Function

''''!!!!
''''目录复制
Function CopyAFolder(SourceFolder,DestinationFolder)
''''//功能:源目录存在时,才能对目录进行复制,目的目录无影响
''''//形参:源目录,目的目录
''''//返回值:成功为1,失败为-1
''''//
''''Dim MyFolder
''''If ReportFolderStatus(SourceFolder) = 1 and ReportFolderStatus

(DestinationFolder) = -1 Then
''''Set MyFolder = fso.GetFolder(SourceFolder)
fso.CopyFolder SourceFolder,DestinationFolder
CopyAFolder = 1
''''Else
CopyAFolder = -1
''''End if
End Function


''''目录进行移动
Function MoveAFolder(SourcePath,DestinationPath)
''''//功能:源目录存在时目的目录不存在时才能对目录进行移动
''''//形参:源目录,目的目录
''''//返回值:成功为1,失败为-1
''''//
If ReportFolderStatus(SourcePath)=1 And ReportFolderStatus(DestinationPath)=0

Then
fso.MoveFolder SourcePath, DestinationPath
MoveAFolder = 1
Else
MoveAFolder = -1
End if
End Function

''''判断目录是否存在
''''Response.Write ReportFolderStatus("G:\soft\delphi\my_pro\")
Function ReportFolderStatus(fldr)
''''//功能:判断目录是否存在
''''//形参:目录
''''//返回值:成功为1,失败为-1
''''//
Dim msg
msg = -1
If (fso.FolderExists(fldr)) Then
msg = 1
Else
msg = -1
End If
ReportFolderStatus = msg
End Function

''''目录创建时信息
Function ShowFolderAccessInfo(FolderName,InfoType)
''''//功能:显示目录创建时信息
''''//形参:目录名,信息类别
''''// 1 -----创建时间
''''// 2 -----上次访问时间
''''// 3 -----上次修改时间
''''// 4 -----目录路径
''''// 5 -----目录名称
''''// 6 -----目录类型
''''// 7 -----目录大小
''''// 8 -----父目录
''''// 9 -----根目录
''''//返回值:成功为目录创建时信息,失败:-1
''''//
Dim f, s
If ReportFolderStatus(FolderName) = 1 then
Set f = fso.GetFolder(FolderName)
select Case InfoType
Case 1 s = f.Datecreated ''''// 1 -----

创建时间
Case 2 s = f.DateLastAccessed ''''// 2 -----上次访问

时间
Case 3 s = f.DateLastModified ''''// 3 -----上次修改

时间
Case 4 s = f.Path ''''// 4

-----文件路径
Case 5 s = f.Name ''''// 5

-----文件名称
Case 6 s = f.Type ''''// 6

-----文件类型
Case 7 s = f.Size ''''// 7

-----文件大小
Case 8 s = f.ParentFolder ''''// 8 -----

父目录
Case 9 s = f.RootFolder ''''// 9 -----

根目录
End select
ShowFolderAccessInfo = s
ELse
ShowFolderAccessInfo = -1
End if
End Function

Function DisplayLevelDepth(pathspec)
Dim f, n ,Path
Set f = fso.GetFolder(pathspec)
If f.IsRootFolder Then
DisplayLevelDepth ="指定的文件夹是根文件夹。"&RootFolder
Else
Do Until f.IsRootFolder
Path = Path & f.Name &"<br>"
Set f = f.ParentFolder
n = n + 1
Loop
DisplayLevelDepth ="指定的文件夹是嵌套级为 " & n & &q
  • 下一篇资讯: ASP如何获取真实IP地址
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号