For all zips, and unzip in working directory and maintains its structure
0
votes
1
answer
465
views
With this command
find . -name '*.zip' -exec unzip '{}' ';'
we find all zip files under . (directory), then unzip them into the current working directory,
**However,** the structure is gone.
/backUp/pic1/1-1.zip
/backUp/pic1/1-2.zip
/backUp/pic2/2-1.zip
/backUp/pic2/2-2.zip
/backUp/pic3/3-1.zip
/backUp/pic3/3-2.zip
/backUp/pic3/3-3.zip
Current command result:
/new/1-1
/new/1-2
/new/2-1
/new/2-2
/new/3-1
/new/3-2
/new/3-3
desired result
/new/pic1/1-1
/new/pic1/1-2
/new/pic2/2-1
/new/pic2/2-2
/new/pic3/3-1
/new/pic3/3-2
/new/pic3/3-3
Asked here, but the code doesn't work out
https://unix.stackexchange.com/questions/691527/what-should-dirname-and-basename-be-in-this-command
Asked by Maxfield
(171 rep)
Feb 23, 2022, 06:32 AM
Last activity: Feb 23, 2022, 06:43 AM
Last activity: Feb 23, 2022, 06:43 AM