Emeditor pro Find in files to find multiple files

497 views Asked by At

I am looking for a way to search many files of one file type for a large number of strings.

Example: Search Doc1.txt, Doc2.txt, Doc3.txt

on Drive C:

Search For aaa.rtf, aba.rtf, ccc.rtf

The standard find in files looks for one single string in many files but not multiple. Edit: This appears to be possible by using batch find.

1

There are 1 answers

0
Yutaka On BEST ANSWER

To search multiple files for multiple strings, you can use the Batch Find in Files feature of EmEditor. To do this:

  1. Select the list of search strings, separated by newlines:
aaa.rtf
aba.rtf
ccc.rtf

in EmEditor or Notepad, and copy the list to the Clipboard. This will make it easier to set up the list in Batch Find in Files later.

  1. In EmEditor, select Find in Files on the Search menu (or press Ctrl + Shift + F).

EmEditor - Find in Files

  1. Click the Batch >> button in the Find in Files dialog box if the Find in Files dialog box appears instead of the Batch Find in Files dialog box.

EmEditor - Batch Find in Files

  1. Right-click the list on the right side of the Batch Find in Files dialog box, and select Paste (or press Ctrl + V). This will paste the list of search strings you copied in the Step 1.

  2. Make sure File Types (*.txt) and In Folder (C:\) are correct.

  3. Click the Batch Find button to find all strings in the specified file types of the specified folder.

If you would like to record these steps as a macro, select Start/Stop Record on the Macros menu (or press Ctrl + Shift + R, or click the Start Recording button on the toolbar) before you do the above step 2. After you do the above step 6, select Start/Stop Record on the Macros menu (or press Ctrl + Shift + R, or click the Start Recording button on the toolbar) again. Once you recorded a macro, you can save it as a macro file by selecting Save As... on the Macros menu. You will get a macro file similar to this:

batch_list = editor.filters;
batch_list.AddFind("aaa.rtf",eeFindReplaceEscSeq,0);
batch_list.AddFind("aba.rtf",eeFindReplaceEscSeq,0);
batch_list.AddFind("ccc.rtf",eeFindReplaceEscSeq,0);
editor.BatchFindInFiles(batch_list,"C:\\*.txt",0,0,"",0,0);

Later, you can select Select... on the Macros menu to select this macro, and then select Run on the Macros menu to run this macro.