If you already have a text file with the list of files or folders that you want PowerGREP to search through, click the Import button to show the Import File Listings screen. This screen provides a variety of options to tell PowerGREP how to extract paths from the text file.
First, click the button with the green plus symbol next to the “files with file listings” list to select one or more text files that list the files or folders you want to search through. You can use the green plus button repeatedly to add files from different folders to the list. The red recycle button deletes the selected file from the list. You can click the Paste button to add a reference to the clipboard as a file with file listings.
Click on one of the files that you added to the “files with file listings” list. PowerGREP then shows the raw contents of that file in the “contents of the selected file” box. PowerGREP also shows the file and folder paths that has detected in that file in the “file paths found in the selected file” list. The settings on the right hand side of the Import File Listings screen determine how PowerGREP detects those paths. PowerGREP automatically filters out anything that does not look like a valid path.
Choose one of the options in the “split file into a list of file paths” box to tell PowerGREP how your list of paths is delimited. If your list doesn’t use a consistent delimiter, select “search for paths” to tell PowerGREP to extract all absolute paths from the file, regardless of any other text that may occur in the file. If you want PowerGREP to extract only certain paths from the file, select one of the two “custom regex” options and type in a regular expression in the box below them. The “custom regex to search for paths” option needs a regular expression that matches the paths you want to mark in the file selection. PowerGREP uses the whole regex match as the path unless it contains a named capturing group called “path”. E.g. ^File=(?'path'.*) extracts the paths from “File” values in an .ini file. The “custom regex to split file” option needs a regular expression that matches the delimiters between those paths. E.g. [\r\n;]+ allows line breaks and semicolons as delimiters.
If you select “absolute paths”, PowerGREP only uses fully qualified paths such as c:\folder\file.txt and \\server\share\folder\file.txt. Any relative paths in the file listing you’re importing are ignored. If you want PowerGREP to process relative paths as well then you need to select the “paths relative to this folder option”. Type in the base folder below that option, or click the (...) button to select it from a folder tree. Note that if your file contains text in addition to paths, you need to use one of the “custom regex” options to tell PowerGREP how to find only the actual paths. Otherwise, PowerGREP will treat each word in the text as a file name. You cannot use the “search for paths” option because that option finds absolute paths only, regardless of the “absolute or relative paths” setting.
Once you’ve set the options that make PowerGREP find the paths that you want to import, you need to tell PowerGREP what you want to do with those paths. The “mark the paths” option provides three choices. Select “include in search” without “include subfolders too” to mark each file or folder with a single green tick, just like the Include File or Folder item in the File Selector menu. Select both “include in search” and “include subfolders too” to mark each folder with a double green tick, just like Include Folder and Subfolders, while still marking files with a single green tick. The third option is to select “exclude from search”, which gives the file or folder a red X like the Exclude File or Folder menu item does.
If you previously marked files or folders in the tree in the file selector, whether you did that manually or by importing a file listing, those markings will remain in place unless you tick both “unmark files and folders” options. If you select only “unmark files and folders marked for inclusion”, then only green ticks are removed. If you select only “unmark files and folders marked for exclusion”, then only red X marks are removed. Leaving existing marks in place can be useful if you want to search through additional files or folders not present in the file listing.
Finally, you can choose when PowerGREP should actually import the file listing. If you select “now”, PowerGREP imports the file listing when you click the OK button. The folders and files tree on the File Selector panel will show you the result. The imported inclusion or exclusion marks become part of the file selection just like they do when you manually include or exclude files. There’s no way to distinguish between files and folders that you marked manually and those that were imported. Choose this option if you want to import the file listing just one time.
If you’re preparing a PowerGREP action that you’ll reuse in the future and the action needs to adapt whenever the text file with the file listings changes, then you need to select “when executing the action”. That tells PowerGREP to import the file listing whenever you execute the action, using the latest contents of the text file(s) you’re importing file listings from. If you’re importing from the clipboard, PowerGREP uses the text that’s on the clipboard at the time you execute the action.
If you turn on both “unmark files and folders” options then you can turn on both the “now” and “when executing the action” options if you want to preview the imported file listings in the folders and files tree as well as make sure that PowerGREP always uses the latest file listings.