用户登录
用户注册

分享至

用通配符搜索指定文件夹中的文件

  • 作者: 用户111002940
  • 来源: 51数据库
  • 2022-08-17
Sub SearchTheName(objFolder)
   If arrOptions(Folder_Name) = 1 Then
      For Each objSubFolder In objFolder.SubFolders
         strName = objSubFolder.Name
         If 0 <> FindInName(strName, strFindKeyWord) Then
            strFoundFile = strFoundFile & objSubFolder.Path & vbCrLf
         End If
      Next
   End If
   For Each objFile In objFolder.Files
      If 0 = InStrRev(strFindKeyWord, ".") Then
         strName = objFso.GetBaseName(objFile.Path)
      Else strName = objFile.Name
      End If
      If 0 <> FindInName(strName, strFindKeyWord) Then
         strFoundFile = strFoundFile & objFile.Path & vbCrLf
      End If
   Next
   If arrOptions(Sub_Folder) <> 1 Then Exit Sub
   For Each objSubfolder In objFolder.SubFolders
      SearchTheName objSubfolder
   Next
End Sub

Dim objShell,objFolder
Set objShell=Createobject("Shell.Application")
Set objFolder=objShell.BrowerFolder(0,"Choose Folder",0,0)
If Not objFolder Is Nothing then
    SearchTheName objFolder.Self.Path
End If
Set objFolder=Nothing
Set objShell=Nothing
软件
前端设计
程序设计
Java相关