开发者

extract specific folder in shell command using unzip

开发者 https://www.devze.com 2022-12-19 22:47 出处:网络
My backup.zip has the following structure. OverallFolder lots开发者_运维知识库 of files and subfolders inside

My backup.zip has the following structure.

OverallFolder

lots开发者_运维知识库 of files and subfolders inside

i used this unzip backup.zip -d ~/public_html/demo

so i end up with ~/public_html/demo/OverallFolder/my other files.

How do i extract so that i end up with all my files INSIDE OverallFolder GOING DIRECTLY into ~public_html/demo?

~/public_html/demo/my other files like this?


if you can't find any options to do that, this is the last resort

mv ~/public_html/demo/OverallFolder/* ~/public_html/demo/


(cd ~public_html/demo; unzip $OLDPWD/backup.zip)

This, in a subshell, changes to your destination directory, unzips the file from your source directory, and when the subshell exits, leaves you back in your source directory.

That, or something similar, should work in most shells.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号