咔叽游戏

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 458|回复: 0

[vbs] VBS遍历文件或文件夹路径输入文件的所有绝对路径(附源码)

[复制链接]

该用户从未签到

发表于 2020-4-17 07:04:08 | 显示全部楼层 |阅读模式
源码如下:

Function listFilesPath(filepath)
  t1=Timer()
  Debug.WriteLine "****现在开始执行计数,用时:"+CStr(t1)
  Set fso=CreateObject("scripting.filesystemobject")
  Set myfolder=fso.GetFolder(filepath)
  If fso.FolderExists(filepath) then
    Set subcol=myfolder.SubFolders
    Set filescol=myfolder.Files
    For Each file In filescol
      Debug.WriteLine filepath+"\"+file.name
    Next
    If subcol.count>0 Then
      For Each folder In subcol
        'Debug.WriteLine filepath+"\"+folder.Name
        listFilesPath(filepath+"\"+folder.Name)
      next

    End if
  Else
    Debug.WriteLine "没有该文件系统"
  End if

  Set filescol=Nothing
  Set subcol=nothing
  Set fso=Nothing
  t2=Timer()
Debug.WriteLine "****现在完成计数,用时:"+CStr(t2)
Debug.WriteLine "整个操作过程用时:"&CStr(t2-t1)&" 秒"
End function之前咔叽网单www.2nzz.com小编更新过类似的文章,大家可以参考一下

原文地址:https://www.jb51.net/article/175945.htm

QQ|免责声明|小黑屋|手机版|Archiver|咔叽游戏

GMT+8, 2024-3-19 16:00

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表