爱问知识人 爱问教育 医院库

VB读取文件列表

首页

VB读取文件列表

'请帮忙把*描述的地方都改成代码,谢谢!

Option Explicit
Public Sub PrintFileList()
    Dim i As Integer
    Dim filelist() As String
    
    '取得扩展名是exe的,所有文件列表
    Call GetFileList("c:\temp\", "exe", filelist)
    
    For i = 0 To UBound(filelist)
        Debug.Print filelist(i)
    Next i
End Sub

Public Sub GetFileList(ByVal in_path As String, _
    ByVal in_ext As String, _
    out_filelist() As String)
    
    *循环读取in_path,及子目录
    *判断是否存在后缀为exe的文件
    *如果存在,添加到out_filelist
    *比如添加字符"c:\temp\a\app1.exe"
      
End Sub

提交回答
好评回答
  • 2006-06-26 13:58:12
    添加reference,microsoft scripting runtime
    dim fso as new filesystemobject
    dim ofile as file
    dim ofolder as folder
    set ofolder =  tfolder("c:\temp\")
    redim filelist(0) as string
    for each ofile in ofolder
      if right( ,4)=".exe" then
         tmpnum=ubound(filelist)
         redim filelist(tmnum+1) as string
         filrlist(tmpnum+1)= 
      end if
    next
    

    s***

    2006-06-26 13:58:12

类似问题

换一换
  • VB 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 173-192
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):