EmEditor Home - EmEditor Help - EmEditor Macro Reference - Editor Object

ReplaceInFiles Method

Replaces text in multiple files.


editor.ReplaceInFiles( strFind, strReplace, strPath, nFlags, nEncoding, strFilesToIgnore, strBackupPath );


editor.ReplaceInFiles strFind, strReplace, strPath, nFlags, nEncoding, strFilesToIgnore, strBackupPath



Specifies a string to search for.


Specifies a string to replace with.


Specifies a path to search from. It can include wild cards such as * and ?.


Specifies a combination of the following values.

eeFindRecursive Searches in subfolders of the specified path.
eeFindReplaceCase Matches cases.
eeFindReplaceEscSeq Uses escape sequences. Cannot combine with eeFindReplaceRegExp.
eeFindReplaceIgnoreFiles Ignores the files or folders specified by strFilesToIgnore.
eeFindReplaceOnlyWord Searches only words.
eeFindReplaceRegExp Uses a regular expression. Cannot combine with eeFindReplaceEscSeq.
eeFindSaveHistory Saves the searched string for repeated search.
eeOpenDetectAll Detects all encodings.
eeOpenDetectCharset Detects HTML/XML Charset.
eeOpenDetectUnicode Detects Unicode signature (BOM).
eeOpenDetectUTF8 Detects UTF-8.
eeReplaceBackup Saves the backups. Cannot combine with eeReplaceKeepOpen.
eeReplaceKeepOpen Keeps the modified files open. Cannot combine with eeReplaceBackup.


Selects from the Encoding Constants, or specify any code page used in the Windows Operating System.


If nFlags  includes eeFindReplaceIgnoreFiles, specifies the file or folder names to ignore. It can include wild cards such as * and ?. To specify multiple files, use semicolons (;) to separate them.


Specifies the backup folder if nFlags  specifies eeReplaceBackup.


This action cannot be undone unless nFlags  specifies eeReplaceKeepOpen. It is recommended to specify eeReplaceBackup as nFlags  and saves backups. If the same file name exists in the backup folder, the new backup will overwrite the old file.


Supported on EmEditor Professional Version 4.02 or later.

Copyright 2003-2015 by Emurasoft, Inc.