A quick tip for all macros that use ReplInFiles

Help with writing and playing macros

A quick tip for all macros that use ReplInFiles

Postby murmel » Tue Sep 20, 2011 11:02 am

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"
User avatar
murmel
Newbie
 
Posts: 3
Joined: Thu Feb 15, 2007 12:00 am

Re: A quick tip for all macros that use ReplInFiles

Postby Mofi » Wed Sep 21, 2011 12:27 am

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.match(/\\$/) == null) 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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros

cron