Is there any way to do a "Find in Files" across multiple directory roots?
For example, looking for the string "foo" in C:\files and D:\files
The "in folder" text box does not seem to like multiple paths. I tried delimiting them with commas, semi-colons, and spaces but with no luck.
Find in Files across multiple root directories
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 4
- Joined: Thu Dec 02, 2004 4:50 pm
- Location: Cambridge, MA
- s_reynisson
- Posts: 939
- Joined: Tue May 06, 2003 1:59 pm
Found this in TP's help file, hope it helps.
Where filelist.txt is in E:\test, in my case it contains just two lines:
TP returns both files in the search results window, only drawback is you have to manually create the list of files.
SoIn the In Files box, either type a space separated list of wild cards, or choose a previous list from the drop-down list. Note that by creating a file containing a list of file names, one per line, and specifying the name of that file in this box, preceded by the character '@', this command will search the specified files.
Code: Select all
Find what: yourString
In files: @filelist.txt
In folder: E:\test\
Code: Select all
E:\test\temp.txt
C:\test\temp.txt
Then I open up and see
the person fumbling here is me
a different way to be
the person fumbling here is me
a different way to be
-
- Posts: 4
- Joined: Thu Dec 02, 2004 4:50 pm
- Location: Cambridge, MA
not quite there
thanks for your help but I should have explained the problem with a little more detail. Unfortunately using the @filelist.txt technique doesn't allow for wildcards in the file. So using your example, I am unable to do the following:
Code:
Find what: yourString
In files: @filelist.txt
In folder: E:\test\
Where filelist.txt is in E:\test, in my case it contains just two lines:
Code:
E:\test\*.txt
C:\test\*.txt
It seems that you need to put literal filenames in filelist.txt which is not really an option for me because I can't count on how many .txt files there are in those directories..or their exact prefixes for that matter.
Any other options?
-Thanks
steve
Code:
Find what: yourString
In files: @filelist.txt
In folder: E:\test\
Where filelist.txt is in E:\test, in my case it contains just two lines:
Code:
E:\test\*.txt
C:\test\*.txt
It seems that you need to put literal filenames in filelist.txt which is not really an option for me because I can't count on how many .txt files there are in those directories..or their exact prefixes for that matter.
Any other options?
-Thanks
steve
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
-
- Posts: 4
- Joined: Thu Dec 02, 2004 4:50 pm
- Location: Cambridge, MA
Thanks but it's not really a desirable option for me. It would be too many extra steps that i'd have to take across many directory roots, each of which could have hundreds of files in them. I also need to use unc paths because the directories live on multiple servers.
my directory list would look something like this:
\\server1\logs\*.txt
\\server2\logs\*.txt
...
\\server20\logs\*.txt
the name and the number of files represented by the * in *.txt is variable
my directory list would look something like this:
\\server1\logs\*.txt
\\server2\logs\*.txt
...
\\server20\logs\*.txt
the name and the number of files represented by the * in *.txt is variable
search across multiple dir
TP will only (to my knowledge and experience) search a specific directory. You should be able to run "find" (UNIX, WIN-NT) as a batch script searching for your 'string' as a parameter, then pipe the results to a file. Then create a macro that reads a line in a file and opens that file.
___________________________________
THX
Lewis Schwartz
LSCHWARTZ@MAIL.MARICOPA.GOV
TP - Where would I be w/o it??
___________________________________
THX
Lewis Schwartz
LSCHWARTZ@MAIL.MARICOPA.GOV
TP - Where would I be w/o it??
___________________________________
-
- Posts: 4
- Joined: Thu Dec 02, 2004 4:50 pm
- Location: Cambridge, MA
Thanks VSLEWIS...I pretty much ended up writing a little find batch utility to do what you said. I've never done anything with TP macros before. Would someone be willing to give me a pointer or two?
My'findstr' results file looks something like this:
\\machine1\share\foo1.txt: <string i was searching for>
\\machine1\share\foo2.txt: <string i was searching for>
\\machine2\share\foo2.txt: <string i was searching for>
\\machine3\share\foo3.txt: <string i was searching for>
etc...
So if i pull this results file into TP, can a macro be made to open the file and go to that specific line in the file....just like when you click on a line in the TP search results window?
My'findstr' results file looks something like this:
\\machine1\share\foo1.txt: <string i was searching for>
\\machine1\share\foo2.txt: <string i was searching for>
\\machine2\share\foo2.txt: <string i was searching for>
\\machine3\share\foo3.txt: <string i was searching for>
etc...
So if i pull this results file into TP, can a macro be made to open the file and go to that specific line in the file....just like when you click on a line in the TP search results window?