Normally, the File Selector is used to determine which files are included in the action, and the search terms on the Action panel are used to search through the contents of those files. But if you want to run a quick search through file names or file paths, you can set the “action type” on the Action panel to “file or folder name search”. Then the search terms in the main part of the action are used to search through the names of the files rather than their contents.
The Results panel will show a list of files of which the names contain one or more of the search terms from step 7. If you want to get a list of files not having any of the search terms in their names, turn on the “invert results” checkbox on the Action panel after setting the action type to “file name search”.
This file selection and action are available in the PowerGREP5.pgl library as “Search through file names”.
For complex operations where you want to use an action type other than “file or folder name search” so that you can search through or manipulate the contents of the files, you can use the File Selector to include or exclude certain files by searching through their names. This example uses the “list files” action type without the search term to demonstrate how searching though file names using the File Selector works.
The Results panel will show a list of files of which the names contain one or more of the search terms from step 6.
If you want to get a list of files not having any of the search terms in their names, enter the search terms from step 6 in the “exclude files” box instead. If you enter search terms in both boxes, you will get a list of files having one or more search terms from “include files”, and none of the search terms from “exclude files” in their names.
To search for different file names in different folders, turn off “same masks for all folders”. Then click on a folder to specify “include files” and “exclude files” for that folder only. Repeat for all other folders you marked in step 2.
To search through both the names of the files, and their contents, go through steps 1 through 7 above to make the file selector search through the file names. You should not select “(unused)” in step 4 though. Treating archives as ordinary files does not produce proper search results when searching through the contents of files. Choose “None” to skip archives, or choose another configuration to search through the contents of the files inside (some) archives. Then proceed as follows:
PowerGREP will then search through the contents of those files of which the names contain one or more of the search terms from step 6. A file will only be listed in the results if both its name matches the terms of step 6, and its contents match the terms of step 9.
PowerGREP cannot produce a list of files that contain a search term in their name, or contain the search term in their contents, but do not contain the search term in both name and contents. You will need to run two searches. One where you enter the search terms in the “include files” box and leave the search terms on the Action page blank, and another where you leave “include files” blank and enter the terms on the Action page.
This file selection and action are available in the PowerGREP5.pgl library as “Search through file names and file contents”.