Bewerken

Share via


TarFile.ExtractToDirectory Method

Definition

Overloads

ExtractToDirectory(Stream, String, Boolean)

Extracts the contents of a stream that represents a tar archive into the specified directory.

ExtractToDirectory(String, String, Boolean)

Extracts the contents of a tar file into the specified directory.

ExtractToDirectory(Stream, String, Boolean)

Source:
TarFile.cs
Source:
TarFile.cs
Source:
TarFile.cs

Extracts the contents of a stream that represents a tar archive into the specified directory.

public:
 static void ExtractToDirectory(System::IO::Stream ^ source, System::String ^ destinationDirectoryName, bool overwriteFiles);
public static void ExtractToDirectory (System.IO.Stream source, string destinationDirectoryName, bool overwriteFiles);
static member ExtractToDirectory : System.IO.Stream * string * bool -> unit
Public Shared Sub ExtractToDirectory (source As Stream, destinationDirectoryName As String, overwriteFiles As Boolean)

Parameters

source
Stream

The stream containing the tar archive.

destinationDirectoryName
String

The path of the destination directory where the filesystem entries should be extracted.

overwriteFiles
Boolean

true to overwrite files and directories in destinationDirectoryName; false to avoid overwriting, and throw if any files or directories are found with existing names.

Exceptions

source or destinationDirectoryName is null.

The destinationDirectoryName directory path is not found.

Permissions are insufficient.

Extracting one of the tar entries would have resulted in a file outside the specified destination directory.

-or-

destinationDirectoryName is empty.

-or-

source does not support reading.

An I/O exception occurred.

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.

Applies to

ExtractToDirectory(String, String, Boolean)

Source:
TarFile.cs
Source:
TarFile.cs
Source:
TarFile.cs

Extracts the contents of a tar file into the specified directory.

public:
 static void ExtractToDirectory(System::String ^ sourceFileName, System::String ^ destinationDirectoryName, bool overwriteFiles);
public static void ExtractToDirectory (string sourceFileName, string destinationDirectoryName, bool overwriteFiles);
static member ExtractToDirectory : string * string * bool -> unit
Public Shared Sub ExtractToDirectory (sourceFileName As String, destinationDirectoryName As String, overwriteFiles As Boolean)

Parameters

sourceFileName
String

The path of the tar file to extract.

destinationDirectoryName
String

The path of the destination directory where the filesystem entries should be extracted.

overwriteFiles
Boolean

true to overwrite files and directories in destinationDirectoryName; false to avoid overwriting, and throw if any files or directories are found with existing names.

Exceptions

sourceFileName or destinationDirectoryName is null.

The destinationDirectoryName directory path is not found.

The sourceFileName file path is not found.

Permissions are insufficient.

Extracting one of the tar entries would have resulted in a file outside the specified destination directory.

-or-

sourceFileName or destinationDirectoryName is empty.

An I/O exception occurred.

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.

Applies to