Click or drag to resize

FileInfoReplace Method (String, String)

Replaces the contents of a specified file with the file described by the current FileInfo object, deleting the original file, and creating a backup of the replaced file.

Namespace:  Alphaleonis.Win32.Filesystem
Assembly:  AlphaFS (in AlphaFS.dll) Version: 2.0
Syntax
public FileInfo Replace(
	string destinationFileName,
	string destinationBackupFileName
)

Parameters

destinationFileName
Type: SystemString
The name of a file to replace with the current file.
destinationBackupFileName
Type: SystemString
The name of a file with which to create a backup of the file described by the destinationFileName parameter.

Return Value

Type: FileInfo
A FileInfo object that encapsulates information about the file described by the destinationFileName parameter.
Remarks
The Replace method replaces the contents of a specified file with the contents of the file described by the current FileInfo object. It also creates a backup of the file that was replaced. Finally, it returns a new FileInfo object that describes the overwritten file.
Remarks
Pass null to the destinationBackupFileName parameter if you do not want to create a backup of the file being replaced.
See Also