zoukankan      html  css  js  c++  java
  • 取得指定路径下的所有文件包括文件夹

    '在使用下面的代码之前一定要导入包文件(Mictosoft Scripting Runtime),否则有一些文件无法执行过去


    dim
    arrFiles(1 to 100) dim cntFile sub GetFile_click() dim strPath as string dim fso as new FileSystemObject dim fd as Folder strPath = ThisWork.Path & "" cntFile = 0 set fd = fso.GetFolder(strPath) call searchFiles(fd) Activesheet.range("A1").Resize(cntFile) = Application.Transponse(arrFiles) end sub sub searchFiles(byval fd as folder) dim fl as file dim sfd as folder for each fl in fd.files cntFile = cntFile + 1 arrFiles(cntFile) = fl.path next if fd.subfolders.count = 0 then exit sub end if for each sfd in fd.subfolders call searchFiles(sfd) next end sub
  • 相关阅读:
    电感
    电容
    电阻
    函数异常规格说明
    异常处理深度解析
    自定义内存管理
    单例类模板
    数组类模板
    数组类模板
    类模板深度剖析
  • 原文地址:https://www.cnblogs.com/killclock048/p/9436322.html
Copyright © 2011-2022 走看看