Zip icon indicating copy to clipboard operation
Zip copied to clipboard

Unzipping adds zip filename as top level folder

Open DwarDoh opened this issue 6 years ago • 5 comments

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)?

DwarDoh avatar Jul 30 '17 07:07 DwarDoh

same happen to me also

kodekarim avatar Aug 09 '17 15:08 kodekarim

The same thing happened to me also, please fix it

kosratdev avatar Dec 12 '17 11:12 kosratdev

issue still exists

ghost avatar Jun 27 '18 00:06 ghost

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.

AndrewHartAR avatar Jul 13 '18 14:07 AndrewHartAR

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)
    }

shravanteegala avatar Mar 25 '21 06:03 shravanteegala