Masternoob
14th February 2012 12:12 UTC
Search and replace in files
is there a way to search and replace a string in multiple files with a wildcard?
for example i want to replace the string abc with xyz in all *.ini files in a directory and all of its subdirectories
i cant figure out a way to do this...
thx for your help :up:
bennaloz
14th February 2012 16:01 UTC
you can navigate folders with FindFirst and FindNext (see manual) and then use this http://nsis.sourceforge.net/Get_extention_of_file to check if it's a .ini file. To replace string I have no idea on how to do it. maybe this http://nsis.sourceforge.net/ReplaceInFile could be helpful
MSG
14th February 2012 17:13 UTC
Originally posted by bennaloz
you can navigate folders with FindFirst and FindNext (see manual) and then use this http://nsis.sourceforge.net/Get_extention_of_file to check if it's a .ini file.
You don't need to get the extension. You can just do FindFirst $0 $1 $INSTDIR\*.ini . This is also clearly shown in the manual:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.5.13As for replacing a string, you could use fileread in a loop or something I guess?
bennaloz
15th February 2012 06:54 UTC
Originally posted by MSG
You can just do FindFirst $0 $1 $INSTDIR\*.ini
ehm... =P you're right I forgot it