当前位置: 代码网 > it编程>前端脚本>其它脚本 > VBS遍历文件或文件夹路径输入文件的所有绝对路径(附源码)

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

2024年05月15日 其它脚本 我要评论
源码如下:function listfilespath(filepath) t1=timer() debug.writeline "****现在开始执行计数,用时:"+cstr(t1) set

源码如下:

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

之前代码网小编更新过类似的文章,大家可以参考一下

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com