Why I used Python to unzip a file Alvin Milton on April 19, 2019 So my day has started like this: I'm ssh'd into a pretty locked down server in a data center. This server runs an instance of Wordpress that I ha... Read full post Collapse Expand Eric L. Frederich Eric L. Frederich Eric L. Frederich Follow Joined Apr 20, 2019 • Apr 20 '19 Dropdown menu Copy link Hide I've been in a locked down Docker container for a GitLab runner. Didn't feel like atp-get, yum, or apk installing unzip. You don't need that script, you can run Python's unzip as a module... python -m zipfile whatever.zip ... Or something like that. Collapse Expand Alvin Milton Alvin Milton Alvin Milton Follow Work Senior Web Developer at New York Magazine Joined Mar 16, 2017 • Apr 25 '19 Dropdown menu Copy link Hide Hey Eric, I tried this and it didn't work locally or on the server. Can you clarify? Collapse Expand Serhiy Storchaka Serhiy Storchaka Serhiy Storchaka Follow Joined Apr 20, 2019 • Apr 20 '19 Dropdown menu Copy link Hide Try just python3 -e wp-fileIwant.zip . Collapse Expand Alvin Milton Alvin Milton Alvin Milton Follow Work Senior Web Developer at New York Magazine Joined Mar 16, 2017 • Apr 25 '19 Dropdown menu Copy link Hide tried it. got unknown option -e as a response... Collapse Expand Serhiy Storchaka Serhiy Storchaka Serhiy Storchaka Follow Joined Apr 20, 2019 • Apr 25 '19 Dropdown menu Copy link Hide Sorry, some words were missed. The correct line is: python3 -m zipfile -e wp-fileIwant.zip . Collapse Expand Aduen Darriba Frederiks Aduen Darriba Frederiks Aduen Darriba Frederiks Follow Joined Apr 21, 2019 • Apr 21 '19 Dropdown menu Copy link Hide tar can also be used for decompressing zip files in most cases Collapse Expand Alvin Milton Alvin Milton Alvin Milton Follow Work Senior Web Developer at New York Magazine Joined Mar 16, 2017 • Apr 25 '19 Dropdown menu Copy link Hide Totally forgot about tar! Collapse Expand eLabFTW eLabFTW eLabFTW Follow Dev of eLabFTW, a free and open source laboratory notebook. Joined Sep 27, 2017 • Apr 20 '19 • Edited on Apr 20 • Edited Dropdown menu Copy link Hide Enter your ssh password Have you heard about ssh keys? ;p Collapse Expand Alvin Milton Alvin Milton Alvin Milton Follow Work Senior Web Developer at New York Magazine Joined Mar 16, 2017 • Apr 25 '19 Dropdown menu Copy link Hide If you are referring to adding my key to ssh-agent, I just did that. Thanks for the tip. Collapse Expand Kyle M. Kyle M. Kyle M. Follow CS student at PSU Location Portland Oregon Joined Mar 28, 2019 • Apr 21 '19 Dropdown menu Copy link Hide Cute story. Made me smile. Took my mind off the grind for a second. Collapse Expand Alvin Milton Alvin Milton Alvin Milton Follow Work Senior Web Developer at New York Magazine Joined Mar 16, 2017 • Apr 25 '19 Dropdown menu Copy link Hide Glad to hear! Collapse Expand Mujeeb Ishaque Mujeeb Ishaque Mujeeb Ishaque Follow Freelance Software Engineer Location Lahore Pakistan Education Masters Of Engineering In Computer Science. Work Self_Employed Joined Apr 19, 2019 • Apr 20 '19 Dropdown menu Copy link Hide Awesome write-up. Thanks, Alvin. Collapse Expand Alvin Milton Alvin Milton Alvin Milton Follow Work Senior Web Developer at New York Magazine Joined Mar 16, 2017 • Apr 25 '19 Dropdown menu Copy link Hide thanks. appreciated. Code of Conduct • Report abuse For further actions, you may consider blocking this person and/or reporting abuse
I've been in a locked down Docker container for a GitLab runner. Didn't feel like atp-get, yum, or apk installing unzip. You don't need that script, you can run Python's unzip as a module...
python -m zipfile whatever.zip
... Or something like that.
Hey Eric,
I tried this and it didn't work locally or on the server.
Can you clarify?
Try just
python3 -e wp-fileIwant.zip .
tried it.
got unknown option -e as a response...
Sorry, some words were missed. The correct line is:
python3 -m zipfile -e wp-fileIwant.zip .
tar can also be used for decompressing zip files in most cases
Totally forgot about tar!
Have you heard about ssh keys? ;p
If you are referring to adding my key to ssh-agent, I just did that.
Thanks for the tip.
Cute story. Made me smile. Took my mind off the grind for a second.
Glad to hear!
Awesome write-up. Thanks, Alvin.
thanks. appreciated.