Edit

Share via


TarEntry.ExtractToFile(String, Boolean) Method

Definition

Extracts the current file or directory to the filesystem. Symbolic links and hard links are not extracted.

public:
 void ExtractToFile(System::String ^ destinationFileName, bool overwrite);
public void ExtractToFile (string destinationFileName, bool overwrite);
member this.ExtractToFile : string * bool -> unit
Public Sub ExtractToFile (destinationFileName As String, overwrite As Boolean)

Parameters

destinationFileName
String

The path to the destination file.

overwrite
Boolean

true if this method should overwrite any existing filesystem object located in the destinationFileName path; false to prevent overwriting.

Exceptions

destinationFileName is null.

destinationFileName is empty.

The parent directory of destinationFileName does not exist.

-or-

overwrite is false and a file already exists in destinationFileName.

-or-

A directory exists with the same name as destinationFileName.

-or-

An I/O problem occurred.

Attempted to extract a symbolic link, a hard link, or an unsupported entry type.

Operation not permitted due to insufficient permissions.

Remarks

Files of type BlockDevice, CharacterDevice, or Fifo can only be extracted in Unix platforms.

Elevation is required to extract a BlockDevice or CharacterDevice to disk.

Symbolic links can be recreated using CreateSymbolicLink(String, String), CreateSymbolicLink(String, String), or CreateAsSymbolicLink(String).

Hard links can only be extracted when using ExtractToDirectory(Stream, String, Boolean) or ExtractToDirectory(String, String, Boolean).

Applies to