FileContent.FindAndAppend
Method | |
---|---|
Module | FileContent |
Library | FileContent |
Action | Appends a string to the end of a file if it does not contain a specified string. |
Parameters | |
Return values | Returns 'Success - No Content' (empty table) if the string is found (file not updated), or the file is not found. If the file is found and updated the following are returned as a table: |
Example | Append the line 'AuthenticationPolicy=required' if it isn't present in example.conf, regardless of case, making a backup of the file before the append occurs. @FilePath = "C:\\temp\\Examples\\Example.conf"; @findString = "AuthenticationPolicy=required"; @appendString = "AuthenticationPolicy=required"; FileContent.FindAndAppend(FilePath: @FilePath, FindString: @findString, AppendString: @appendString, Backup:true, CaseSensitive:false); |
Platforms |
|
Notes | Text is appended only if the find string does not exist in the file; this method should have been called FindElseAppend. |