在linux中使用unzip时遇到问题

时间:2013-12-15 11:25:07

标签: linux centos unzip

关于解压缩,我有两个问题

  1. 我试图在第一个父目录之后提取zip文件。 我正在尝试这个并且它不起作用

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

  2. 我的旧文件中的其他问题有人使用了unzip -W标记,这是我在手册页中找不到的。它做了什么

  3. 我试过这个

    [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 个答案:

答案 0 :(得分:0)

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.)