VB怎么扫描指定磁盘下的指定格式文件是否存在 固定的一些字符比如扫描 整个C盘下的所有TXT文件把 内容包含 “我爱你” 的所有绝对路径写入list
解决方案 »
- 开发好的软件,可以打开N次 打开N个 怎么解决这个问题?
- 如何得到文本框中最左边的字符的绝对位置
- 请大家一定帮帮我,我在csdn问了两个月了,都没人回我
- 使用TCP协议开发C/S聊天程序,最大能够支持多少人?
- 请教各位:我想在textbox控件中显示label控件,该怎么办啊???
- 调试出错,open
- 请问大家一个问题啊?
- vb怎样打包能在Windows Vista windows 7下运行
- Data-aware classes通常在什么情况下用?
- 我在一个FORM里建立了一个Set fs = CreateObject("Scripting.FileSystemObject")……
- select csse 的问题,请帮忙
- 窗体之间如何传递值?
folder_file "E:\temp"
End Sub
Public Sub folder_file(strPath As String)
Dim objFolder As Scripting.Folder '文件夹对象
Dim objFile As Scripting.File '文件对象
Dim objSubdirs As Scripting.Folders '文件夹集合对象
Dim objLoopFolder As Scripting.Folder '文件夹对象
Set m_FSO = New Scripting.FileSystemObject
Set objFolder = m_FSO.GetFolder(strPath)
For Each objFile In objFolder.Files
rig_path = LCase$(Right$(objFile.ShortPath, 4))
If rig_path = ".txt" And InStr(objFile.Name, "我爱你") Then '如果只对文件名:InStr(objFile.Name, "我爱你"),如果是文件路径:InStr(objFile.ShortPath, "我爱你")
List1.AddItem Left(objFile.ShortPath, InStrRev(objFile.ShortPath, "\")) & objFile.Name
End If
Next objFile
Set objSubdirs = objFolder.SubFolders
For Each objLoopFolder In objSubdirs
folder_file objLoopFolder.Path
Next objLoopFolder
Set objSubdirs = Nothing
Set objFolder = Nothing
End Sub