• Win10 cmd如何试用tar命令压缩和解压文件夹


    环境:

    Win10 专业版

    Microsoft Windows [版本 10.0.19041.208]

    问题描述:

    Win10 cmd如何试用tar命令压缩和解压文件夹

    C:\Users\Administrator>tar --help
    tar(bsdtar): manipulate archive files
    First option must be a mode specifier:
      -c Create  -r Add/Replace  -t List  -u Update  -x Extract
    Common Options:
      -b #  Use # 512-byte records per I/O block
      -f <filename>  Location of archive (default \\.\tape0)
      -v    Verbose
      -w    Interactive
    Create: tar -c [options] [<file> | <dir> | @<archive> | -C <dir> ]
      <file>, <dir>  add these items to archive
      -z, -j, -J, --lzma  Compress archive with gzip/bzip2/xz/lzma
      --format {ustar|pax|cpio|shar}  Select archive format
      --exclude <pattern>  Skip files that match pattern
      -C <dir>  Change to <dir> before processing remaining files
      @<archive>  Add entries from <archive> to output
    List: tar -t [options] [<patterns>]
      <patterns>  If specified, list only entries that match
    Extract: tar -x [options] [<patterns>]
      <patterns>  If specified, extract only entries that match
      -k    Keep (don't overwrite) existing files
      -m    Don't restore modification times
      -O    Write entries to stdout, don't restore to disk
      -p    Restore permissions (including ACLs, owner, file flags)
    bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    命令参数解释
    t	显示档案文件列表内容(已压缩的文件)
    x	解压档案文件
    c	生成档案文件,创建打包文件
    f	指定档案文件名称,f必须放在命令参数最后
    
    • 1
    • 2
    • 3
    • 4
    • 5

    解决方案:

    1.压缩文件

    cmd命令

    tar -cf xxx.tar.gz ./xxx

    打包123.txt文件

    tar -cf 123.tar.gz ./123.txt
    
    • 1

    在这里插入图片描述打包345文件夹

    tar -cf 345.tar.gz ./345
    
    • 1

    在这里插入图片描述

    2.解压文件

    cmd命令

    tar -xf xxx.tar.gz

    解压 345.tar.gz文件

    tar -xf 345.tar.gz
    
    • 1

    在这里插入图片描述

  • 相关阅读:
    【AI视野·今日CV 计算机视觉论文速览 第260期】Wed, 4 Oct 2023
    20221116 今天的世界发生了什么
    10个常见触发IO瓶颈的高频业务场景
    Lodash库
    重修SpringMVC(二)
    扩展的以太网
    Spring Boot 面试热点(一)
    解决XXLJOB重复执行问题--Redis加锁+注解+AOP
    使用Enterprise Architect(EA)的插件AtScope,解析代码中函数和变量调用关系
    OpenMV与JSON编码
  • 原文地址:https://blog.csdn.net/weixin_42672685/article/details/132900030