I need to unzip a .zip file which is password protected using Terminal
I am able to unzip the .zip file (if it is not password protected) using this command
unzip /Users/vikas/Desktop/as.zip -d /Users/vikas/Desktop/new\ folderNote: I need to pass the password in the command. I know when it asks for the password, but my scenario is different as I have to pass the password in the command itself (e.g. -p "my password" in Linux).
4 Answers
Use the -P password argument to pass the password to unzip:
unzip -P password /Users/vikas/Desktop/as.zip -d /Users/vikas/Desktop/new\ folder 2 In case of AES encryption unzip won't work. In such case 7z do the trick perfectly:
7z x <archive_name> 1 you can use "Unarchiver" for it, works perfect.
1Sometime, unzip command doesn't work for me, so replace unzip with ditto will solve issue:
ditto -V -x -k --password --sequesterRsrc --rsrc FILENAME.ZIP DESTINATIONDIRECTORY