A quick tip for all macros that use ReplInFiles

A quick tip for all macros that use ReplInFiles

3
NewbieNewbie
3

    Sep 20, 2011#1

    I was having problems to get a macro with ReplInFiles running and it took me a while to find out why.

    This does not work
    ReplInFiles "C:\temp\ultra" "*.txt" "a" "b"

    This does:
    ReplInFiles "C:\temp\ultra\" "*.txt" "a" "b"

    6,603548
    Grand MasterGrand Master
    6,603548

      Sep 21, 2011#2

      Well, I have several times written that the directory path must end with a backslash. So this is nothing new. See for example my GetListOfFiles.js script function which contains the code lines:

      Code: Select all

      // Append a backslash if it is missing at end of the directory string.
      else if (sDirectory[sDirectory.length-1] != "\\") sDirectory += "\\";
      If you browse to a directory in Replace in Files dialog and select it, you will see in the dialog that the path of the selected directory ends with a backslash. It should be clear for everyone that when all directory paths in Replace in Files dialog end always with a backslash, that the macro command ReplInFiles requires also a backslash at end of the path.