Home > Net >  Ask how to avoid the ZipFile. ExtractToDirectory IOException
Ask how to avoid the ZipFile. ExtractToDirectory IOException

Time:11-12

Known to the target file already exists (because is loaded driver cannot be deleted), using the ZipFile. Error always jump out when ExtractToDirectory decompression to cover as follows, do you have to jump over these files? Or prohibit these error messages in the CMD is shown below, thank you,

The Write temp files to folder failed, System. IO, IOException: file "C: \ Users \ Fred \ AppData \ Local \ temp \ Ng32B5s3ZjGOoo0KxkwWDQKK \ GlFlash_v1 17. Fl" already exists.
In the System. IO. __Error. WinIOError (Int32 errorCode, String maybeFullPath)
In the System. IO. FileStream. Init (String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
In the System. IO. FileStream.. Ctor (String path, FileMode mode, FileAccess access, FileShare share)
The System.IO.Com pression. ZipFileExtensions. ExtractToFile (ZipArchiveEntry source, the String destinationFileName, Boolean overwrite)
On the System.IO.Com pression. ZipFileExtensions. ExtractToDirectory (ZipArchive source, the String destinationDirectoryName)
The System.IO.Com pression. ZipFile. ExtractToDirectory (String sourceArchiveFileName, String destinationDirectoryName, Encoding entryNameEncoding)

CodePudding user response:

Public static void ExtractToDirectory (string sourceArchiveFileName, string destinationDirectoryName, bool overwriteFiles ).

CodePudding user response:

You check, I remember that there is method can extract the ZipFile,
Skip the specified file does not cover the source file,

CodePudding user response:

reference 1st floor github_36000833 response:
public static void ExtractToDirectory (string sourceArchiveFileName, string destinationDirectoryName, bool overwriteFiles ).


However, I only see this a few methods in space, couldn't find you mention format,, what reason be? Excuse me,
The namespace System.IO.Com pression
{
Public static void ExtractToDirectory (string sourceArchiveFileName, string destinationDirectoryName);
Public static void ExtractToDirectory (string sourceArchiveFileName, string destinationDirectoryName, Encoding entryNameEncoding);
}

CodePudding user response:

But the new temporary folder, and then fileCopy reached the target and its overWrite switch,

CodePudding user response:

File already exists, or is the target file system is case sensitive, and Windows does not distinguish, and there are two that differ only in their file with the same name exist at the same time
  •  Tags:  
  • C#
  • Related