zoukankan      html  css  js  c++  java
  • Creating an archive from a directory without the directory name being added to the archive

    Creating an archive from a directory without the directory name being added to the archive

    From the 7-Zip Help file:

    a (Add) command

    Adds files to archive.

    Examples

    7z a archive1.zip subdir

    adds all files and subfolders from folder subdir to archive archive1.zip. The filenames in archive will contain subdir prefix.

    7z a archive2.zip .subdir*

    adds all files and subfolders from folder subdir to archive archive2.zip. The filenames in archive will not contain subdir prefix.

    cd /D c:dir1

    7z a c:archive3.zip dir2dir3

    The filenames in archive c:archive3.zip will contain dir2dir3 prefix, but they will not contain c:dir1 prefix.

    So the command you'd want would be: 7za.exe a folder1.zip .folder1*

    Also, pay attention to 7-Zip's handling of wildcards. It doesn't treat *.* as "all files" -- it means "all files with a period in the filename." Extension-less files will be missed. If you really want all files, just use * instead.

    Finally, the -tzip parameter isn't needed if the archive filename ends in .zip. 7-Zip is smart enough to figure out which format you want in those cases. It's only required when you want a custom extension (e.g. 7za.exe a -tzip foo.xpi <files> for a Mozilla Add-on).

  • 相关阅读:
    第三周作业
    第二周作业
    第一周作业
    第三次作业
    第二次作业
    c语言最后一次作业
    第14、15教学周作业
    第七周作业
    第六周随笔
    第四周作业
  • 原文地址:https://www.cnblogs.com/chucklu/p/14769864.html
Copyright © 2011-2022 走看看