How do I zip a folder using the command line while maintaining its file structure?
3
votes
2
answers
3309
views
For example, if I want to zip
/Users/admin/Downloads/Backup
, and I am at /Users/admin/
, I could:
zip -r downloads.zip /Users/admin/Downloads/Backup
and if I unzip downloads.zip
I would get a Users folder and have a Users => admin => Downloads => Backup structure.
This is particularly undesirable behavior if I want to create an installation zip file for TWRP.
So instead I will have to:
cd /Users/admin/Downloads/Backup; zip -r /Users/admin/downloads.zip .; cd /Users/admin/
This doesn’t feel like what a pro would do.
What can I do to zip a folder while maintaining its file structure?
Asked by aeroxy
(3367 rep)
Nov 10, 2018, 01:54 PM
Last activity: May 13, 2023, 08:07 PM
Last activity: May 13, 2023, 08:07 PM