gpt4 book ai didi

linux - 在 Linux 中使用 unzip 时遇到问题

转载 作者:太空宇宙 更新时间:2023-11-04 04:07:30 25 4
gpt4 key购买 nike

我有两个关于解压的问题

  1. 我正在尝试提取 zip 文件第一个父目录之后的所有内容。我正在尝试这个,但它不起作用

    unzip -d /var/www/html/data/ file-gpl.zip */*

  2. 我的旧文件中有人使用过的其他问题 unzip -W我在手册页中找不到的标志。它有什么作用

我试过了

[20:59][user1@core:/var/www/html/build]$ unzip -W -d test file.zip
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
Default action is to extract files in list, except those in xlist, to exdir;
file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage).

-p extract files to pipe, no messages -l list files (short format)
-f freshen existing files, create none -t test compressed archive data
-u update files, create if necessary -z display archive comment only
-v list verbosely/show version info -T timestamp archive to latest
-x exclude files that follow (in xlist) -d extract files into exdir
modifiers:
-n never overwrite existing files -q quiet mode (-qq => quieter)
-o overwrite files WITHOUT prompting -a auto-convert any text files
-j junk paths (do not make directories) -aa treat ALL files as text
-U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields
-C match filenames case-insensitively -L make (some) names lowercase
-X restore UID/GID info -V retain VMS version numbers
-K keep setuid/setgid/tacky permissions -M pipe through "more" pager
See "unzip -hh" or unzip.txt for more help. Examples:
unzip data1 -x joe => extract all files except joe from zipfile data1.zip
unzip -p foo | more => send contents of foo.zip via pipe into program more
unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer

最佳答案

1. unzip -d ./new/destination example.zip

2. I got the description for -W flag from my box is below

-W [only when WILD_STOP_AT_DIR compile-time option enabled] modifies the pattern matching routine so that both ‘?’ (single-char wildcard)
and ‘*’ (multi-char wildcard) do not match the directory separator character ‘/’. (The two-character sequence ‘‘**’’ acts as a multi-
char wildcard that includes the directory separator in its matched characters.) Examples:

"*.c" matches "foo.c" but not "mydir/foo.c"
"**.c" matches both "foo.c" and "mydir/foo.c"
"*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
"??*/*" matches "ab/foo" and "abc/foo"
but not "a/foo" or "a/b/foo"

This modified behaviour is equivalent to the pattern matching style used by the shells of some of UnZip’s supported target OSs (one
example is Acorn RISC OS). This option may not be available on systems where the Zip archive’s internal directory separator character
‘/’ is allowed as regular character in native operating system filenames. (Currently, UnZip uses the same pattern matching rules for
both wildcard zipfile specifications and zip entry selection patterns in most ports. For systems allowing ‘/’ as regular filename char-
acter, the -W option would not work as expected on a wildcard zipfile specification.)

关于linux - 在 Linux 中使用 unzip 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20593933/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com