Thursday, July 4, 2024

zip – partial unzip from terminal

The -C seems to be what you want:

unzip -C "fritzs-mac-pro_2022.4.2_8-15-20-30-13 - T" "OWC MiniStack/Music/Tom Waits/Mule Variations/*" -d ~/Downloads

From macOS’s man zip entry:

-C

use case-insensitive matching for the number of archive entries from the command-line listing of extract choice patterns. unzip’s philosophy is “you get what you ask for” (that is additionally answerable for the -L/-U change; see the related choices beneath). As a result of some file methods are absolutely case-
delicate (notably these below the Unix working system) and since each ZIP archives and unzip itself are transportable throughout platforms, unzip’s default conduct is to match each wildcard and literal filenames case-sensitively. That’s, specifying “makefile” on the command line will solely match
“makefile” within the archive, not “Makefile” or “MAKEFILE” (and equally for wildcard specs). Since this doesn’t correspond to the conduct of many different working/file methods (for instance, OS/2 HPFS, which preserves blended case however shouldn’t be delicate to it), the -C choice could also be used
to drive all filename matches to be case-insensitive. Within the instance above, all three recordsdata would then match “makefile” (or “make*”, or comparable). The -C choice impacts file specs in each the traditional file listing and the excluded-file listing (xlist).

Please be aware that the -C choice does neither have an effect on the seek for the zipfile(s) nor the matching of archive entries to present recordsdata on the extraction path. On a case-sensitive file system, unzip won’t ever attempt to overwrite a file “FOO” when extracting an entry “foo”!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles