Task

Replace every occurring instance of a piece of text in a group of text files with another one.



For this task we want to replace the text   "Goodbye London!"   with   "Hello New York!"   for a list of files.




open System.IO
 
[<EntryPoint>]
let main args =
    let textFrom = "Goodbye London!"
    let textTo = "Hello New York!"
    for name in args do
        let content = File.ReadAllText(name)
        let newContent = content.Replace(textFrom, textTo)
        if content <> newContent then
            File.WriteAllText(name, newContent)
    0