System.IO.Compression.ZipFile Provides static methods for creating, extracting, and opening zip archives. Creates a zip archive that contains the files and directories from the specified directory. The path to the directory to be archived, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. The path of the archive to be created, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. or is , contains only white space, or contains at least one invalid character. or is null. In or , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. is invalid or does not exist (for example, it is on an unmapped drive). already exists.-or-A file in the specified directory could not be opened. specifies a directory.-or-The caller does not have the required permission to access the directory specified in or the file specified in . or contains an invalid format.-or-The zip archive does not support writing. Creates a zip archive that contains the files and directories from the specified directory, uses the specified compression level, and optionally includes the base directory. The path to the directory to be archived, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. The path of the archive to be created, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry. true to include the directory name from at the root of the archive; false to include only the contents of the directory. or is , contains only white space, or contains at least one invalid character. or is null. In or , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. is invalid or does not exist (for example, it is on an unmapped drive). already exists.-or-A file in the specified directory could not be opened. specifies a directory.-or-The caller does not have the required permission to access the directory specified in or the file specified in . or contains an invalid format.-or-The zip archive does not support writing. Creates a zip archive that contains the files and directories from the specified directory, uses the specified compression level and character encoding for entry names, and optionally includes the base directory. The path to the directory to be archived, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. The path of the archive to be created, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry. true to include the directory name from at the root of the archive; false to include only the contents of the directory. The encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names. or is , contains only white space, or contains at least one invalid character.-or- is set to a Unicode encoding other than UTF-8. or is null. In or , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. is invalid or does not exist (for example, it is on an unmapped drive). already exists.-or-A file in the specified directory could not be opened. specifies a directory.-or-The caller does not have the required permission to access the directory specified in or the file specified in . or contains an invalid format.-or-The zip archive does not support writing. Extracts all the files in the specified zip archive to a directory on the file system. The path to the archive that is to be extracted. The path to the directory in which to place the extracted files, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. or is , contains only white space, or contains at least one invalid character. or is null. The specified path in or exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. The specified path is invalid (for example, it is on an unmapped drive). The directory specified by already exists.-or-The name of an entry in the archive is , contains only white space, or contains at least one invalid character.-or-Extracting an archive entry would create a file that is outside the directory specified by . (For example, this might happen if the entry name contains parent directory accessors.) -or-An archive entry to extract has the same name as an entry that has already been extracted from the same archive. The caller does not have the required permission to access the archive or the destination directory. or contains an invalid format. was not found. The archive specified by is not a valid zip archive.-or-An archive entry was not found or was corrupt.-or-An archive entry was compressed by using a compression method that is not supported. Extracts all the files in the specified zip archive to a directory on the file system and uses the specified character encoding for entry names. The path to the archive that is to be extracted. The path to the directory in which to place the extracted files, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. The encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names. or is , contains only white space, or contains at least one invalid character.-or- is set to a Unicode encoding other than UTF-8. or is null. The specified path in or exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. The specified path is invalid (for example, it is on an unmapped drive). The directory specified by already exists.-or-The name of an entry in the archive is , contains only white space, or contains at least one invalid character.-or-Extracting an archive entry would create a file that is outside the directory specified by . (For example, this might happen if the entry name contains parent directory accessors.) -or-An archive entry to extract has the same name as an entry that has already been extracted from the same archive. The caller does not have the required permission to access the archive or the destination directory. or contains an invalid format. was not found. The archive specified by is not a valid zip archive.-or-An archive entry was not found or was corrupt.-or-An archive entry was compressed by using a compression method that is not supported. Opens a zip archive at the specified path and in the specified mode. The opened zip archive. The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. One of the enumeration values that specifies the actions which are allowed on the entries in the opened archive. is , contains only white space, or contains at least one invalid character. is null. In , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. is invalid or does not exist (for example, it is on an unmapped drive). could not be opened.-or- is set to , but the file specified in already exists. specifies a directory.-or-The caller does not have the required permission to access the file specified in . specifies an invalid value. is set to , but the file specified in is not found. contains an invalid format. could not be interpreted as a zip archive.-or- is , but an entry is missing or corrupt and cannot be read.-or- is , but an entry is too large to fit into memory. Opens a zip archive at the specified path, in the specified mode, and by using the specified character encoding for entry names. The opened zip archive. The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. One of the enumeration values that specifies the actions that are allowed on the entries in the opened archive. The encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names. is , contains only white space, or contains at least one invalid character.-or- is set to a Unicode encoding other than UTF-8. is null. In , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. is invalid or does not exist (for example, it is on an unmapped drive). could not be opened.-or- is set to , but the file specified in already exists. specifies a directory.-or-The caller does not have the required permission to access the file specified in . specifies an invalid value. is set to , but the file specified in is not found. contains an invalid format. could not be interpreted as a zip archive.-or- is , but an entry is missing or corrupt and cannot be read.-or- is , but an entry is too large to fit into memory. Opens a zip archive for reading at the specified path. The opened zip archive. The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory. is , contains only white space, or contains at least one invalid character. is null. In , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. is invalid or does not exist (for example, it is on an unmapped drive). could not be opened. specifies a directory.-or-The caller does not have the required permission to access the file specified in . The file specified in is not found. contains an invalid format. could not be interpreted as a zip archive. Provides extension methods for the and classes. Archives a file by compressing it and adding it to the zip archive. A wrapper for the new entry in the zip archive. The zip archive to add the file to. The path to the file to be archived. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. The name of the entry to create in the zip archive. is , contains only white space, or contains at least one invalid character.-or- is . or is null. In , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. is invalid (for example, it is on an unmapped drive). The file specified by cannot be opened. specifies a directory.-or-The caller does not have the required permission to access the file specified by . The file specified by is not found. The parameter is in an invalid format.-or-The zip archive does not support writing. The zip archive has been disposed. Archives a file by compressing it using the specified compression level and adding it to the zip archive. A wrapper for the new entry in the zip archive. The zip archive to add the file to. The path to the file to be archived. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. The name of the entry to create in the zip archive. One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry. is , contains only white space, or contains at least one invalid character.-or- is . or is null. is invalid (for example, it is on an unmapped drive). In , the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. The file specified by cannot be opened. specifies a directory.-or-The caller does not have the required permission to access the file specified by . The file specified by is not found. The parameter is in an invalid format.-or-The zip archive does not support writing. The zip archive has been disposed. Extracts all the files in the zip archive to a directory on the file system. The zip archive to extract files from. The path to the directory to place the extracted files in. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. is , contains only white space, or contains at least one invalid character. is null. The specified path exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. The specified path is invalid (for example, it is on an unmapped drive). The directory specified by already exists.-or-The name of an entry in the archive is , contains only white space, or contains at least one invalid character.-or-Extracting an entry from the archive would create a file that is outside the directory specified by . (For example, this might happen if the entry name contains parent directory accessors.) -or-Two or more entries in the archive have the same name. The caller does not have the required permission to write to the destination directory. contains an invalid format. An archive entry cannot be found or is corrupt.-or-An archive entry was compressed by using a compression method that is not supported. Extracts an entry in the zip archive to a file. The zip archive entry to extract a file from. The path of the file to create from the contents of the entry. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .-or- specifies a directory. is null. The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. The specified path is invalid (for example, it is on an unmapped drive). already exists.-or- An I/O error occurred.-or-The entry is currently open for writing.-or-The entry has been deleted from the archive. The caller does not have the required permission to create the new file. The entry is missing from the archive, or is corrupt and cannot be read.-or-The entry has been compressed by using a compression method that is not supported. The zip archive that this entry belongs to has been disposed. is in an invalid format. -or-The zip archive for this entry was opened in mode, which does not permit the retrieval of entries. Extracts an entry in the zip archive to a file, and optionally overwrites an existing file that has the same name. The zip archive entry to extract a file from. The path of the file to create from the contents of the entry. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. true to overwrite an existing file that has the same name as the destination file; otherwise, false. is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .-or- specifies a directory. is null. The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. The specified path is invalid (for example, it is on an unmapped drive). already exists and is false.-or- An I/O error occurred.-or-The entry is currently open for writing.-or-The entry has been deleted from the archive. The caller does not have the required permission to create the new file. The entry is missing from the archive or is corrupt and cannot be read.-or-The entry has been compressed by using a compression method that is not supported. The zip archive that this entry belongs to has been disposed. is in an invalid format. -or-The zip archive for this entry was opened in mode, which does not permit the retrieval of entries.