Zip
Zip copied to clipboard
Unzipping adds zip filename as top level folder
If I have a zip file that is a zipped folder, the name of the zip file becomes the folder name, using standard archiving tools, i.e. OSX compress.
When unzipping using Zip, the zip file name is automatically added as a top level directory and then the unzipped files go under that. So you end up with the folder name added as two nested directories.
This is not how it was zipped, and not how other archive tools work. (The Unarchiver, OSX Folder, Stuffit Expander)
Can we add a setting to eliminate the automatic top level folder addition (that's not part of the zipped content)?
same happen to me also
The same thing happened to me also, please fix it
issue still exists
I thought I had this issue too - it turns out that zipping a folder on Mac creates a zip with that folder's name, and then puts that folder inside of it. So for me it was a macOS behaviour that I hadn't realised was occurring.
Try this Solution : solve by customising below code.
let documentsUrl = fileManager.temporaryDirectory #else let documentsUrl = fileManager.urls(for: self.searchPathDirectory(), in: .userDomainMask)[0] #endif do { let custdestinationUrl = documentsUrl.appendingPathComponent("content/") let destinationUrl = custdestinationUrl.appendingPathComponent(directoryName, isDirectory: true) try self.unzipFile(path, destination: destinationUrl, overwrite: true, password: nil, progress: progress)
print("RETURN Dest url is:", destinationUrl)
return destinationUrl
}catch{
throw(ZipError.unzipFail)
}