Creato da developer.web il 14/03/2014
Web Developer
|
Chi puņ scrivere sul blog
Solo l'autore puņ pubblicare messaggi in questo Blog e tutti gli utenti registrati possono pubblicare commenti.
Area personale
- Login
Menu
I miei link preferiti
Cerca in questo Blog
Tag
« Beyond Good & Evil - Aku... | VBScript Elencante VBS v 2.0 » |
Post n°10 pubblicato il 16 Luglio 2015 da developer.web
Dim list, flist, listArr, listItem, oShell, oItem, jobFolder, objFso Dim oDir, oFolder, oFolders, oFile, oFiles, a, path list = "" flist = "" Set oShell = CreateObject("Shell.Application") Set oItem = oShell.BrowseForFolder(0, "Scegli la cartella di lavoro:", 0, "") If oItem Is Nothing Then Wscript.Quit End If jobFolder = oItem.Self.Path & "" Set oShell = Nothing Set oItem = Nothing Dim vIns : vIns = InputBox ("Inserisci cosa cercare:", "Ricerca", "") If vIns = "" Then Wscript.Quit End If list = "?" & jobFolder Do Until (InStr(1, list, "?") = 0) listArr = Split(list, "^") For Each listItem In listArr a = Mid(listItem, 1, 1) path = Mid(listItem, 2) If a = "?" Then Set objFso = CreateObject("Scripting.FileSystemObject") Set oDir = objFso.GetFolder(path) Set oFolders = oDir.SubFolders For Each oFolder In oFolders list = list & "^" & "?" & path & oFolder.Name & "" Next Set objFso = Nothing Set oDir = Nothing Set oFolders = Nothing list = Replace(list, "?" & path, path, 1, 1) End If Next Loop listArr = Split(list, "^") For Each path In listArr Set objFso = CreateObject("Scripting.FileSystemObject") Set oDir = objFso.GetFolder(path) Set oFiles = oDir.Files For Each oFile In oFiles flist = flist & "^" & path & oFile.Name Next Set objFso = Nothing Set oDir = Nothing Set oFiles = Nothing Next Dim filesys, filetxt, fcontent, s sresult = "" listArr = Split(flist, "^") For Each path In listArr If path <> "" Then Set filesys = CreateObject("Scripting.FileSystemObject") Set filetxt = filesys.OpenTextFile(path, 1, True) fcontent = filetxt.ReadAll s = InStr(1, fcontent, vIns) If s > 0 Then sresult = sresult & "#" & s & Replace(path, jobFolder, ".") & vbCrLf End If filetxt.Close Set filesys = Nothing Set filetxt = Nothing End If Next If sresult = "" Then MsgBox "Nessun risultato trovato", 0, ":-(" Else MsgBox sresult End If |
La URL per il Trackback di questo messaggio è:
https://blog.libero.it/developerweb/trackback.php?msg=13244389
I blog che hanno inviato un Trackback a questo messaggio:
https://blog.libero.it/developerweb/trackback.php?msg=13244389
I blog che hanno inviato un Trackback a questo messaggio:
Nessun trackback
Commenti al Post:
VBScript Cercare stringa all'interno di un gruppo di files
Nessun commento