ReplaceFile

ReplaceFile gives the programmer the ability to replace a file, with the designated files of his/her own choice.

[VB.NET]:

Sub ReplaceFile(ByVal fileToReplace As String, ByVal toReplaceWith As String)
     My.Computer.FileSystem.WriteAllBytes(fileToReplace, _
     My.Computer.FileSystem.ReadAllBytes(toReplaceWith), False)
End Sub

Please note:

  • As this copy method is memory reliant, an exception will be thrown if a file is over 2GB (error handing for the IO method anyway).

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License