`
yidongkaifa
  • 浏览: 4059290 次
文章分类
社区版块
存档分类
最新评论

遍历目录下所有的子文件

 
阅读更多

给一个简单的获取目录下所有的子文件脚本,以后可能会有用到:

'设定指定目录
FolderPath = "d:\xi"'创建fso组件
Set fso = CreateObject("scripting.filesystemobject")
'获取指定目录的文件夹
Set oFolder = fso.GetFolder(FolderPath)
'获取指定文件夹下的所有文件
Set oFiles = oFolder.Files

For Each f In oFiles
MsgBox f.Name
Next

'释放对象
Set f = Nothing
Set
oFiles = Nothing
Set
oFolder = Nothing
Set
fso = Nothing

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics