Sample Header Ad - 728x90

Does unzip have a way to extract only a specific subfolder without creating that folder's parent dirs?

1 vote
2 answers
196 views
I want to extract a specific subfolder (and all its contents) from a .zip using the standard unzip tool. I am not interested in its parent directories and don't want them to be created. For example: unzip /path/to/archive.zip "var/www/html/example.com/*" -d ~/website I would like the ~/website folder to contain **only** the contents of example.com from the archive but in reality, unzip recreates the folder's parent directory path so I actually end up with ~/website/var/www/html/example.com. I saw this question about extracting a specific folder but it did not answer this question.
Asked by Clanape (13 rep)
Oct 23, 2024, 01:47 AM
Last activity: Oct 23, 2024, 04:55 PM