zoukankan      html  css  js  c++  java
  • Mac 像windows一样使用右键压缩文件,使用p7zip实现

    具体参考 https://www.xiebruce.top/202.html
    其介绍的非常详细。
    只是对其中压缩的时候文件名作了一下修改,使压缩多个文件的时候加上日期作为文件的一部分。

    安装 p7zip

    brew install p7zip

    在邮件菜单中添加快捷方式

    利用 Automator 制作 快速操作。
    ⌘ + space -> 输入:自动操作 -> 新建文稿 -> 快速操作 -> 选择:操作>实用工具>运行shell脚本

    具体设置贴图

    下面 name="ZIP-"$(date "+%Y%m%d-%H%M%S") 可以修改为自定义的名称

    set -e
    compress_method="zip"
    [[ $# = 1 ]] && name=${1##*/} || name="ZIP-"$(date "+%Y%m%d-%H%M%S")
    base=${1%/*}
    cd "$base"
    
    i=2
    [[ -e "$name.$compress_method" ]] && name="$name-$i"
    while [[ -e "$name.$compress_method" ]]; do name="${name%??}-$((++i))"; done
    
    echo ".DS_Store" >> .exclude_file_list
    /usr/local/bin/7z a -r -t"$compress_method" ./"$name.$compress_method" "${@#"$base"/}" -xr@.exclude_file_list
    rm .exclude_file_list
    open -R ./"$name.$compress_method"
    
  • 相关阅读:
    BSP与HAL关系(转)
    [Advanced Algorithm]
    [Advanced Algorithm]
    [Advanced Algorithm]
    [Intermediate Algorithm]
    [Intermediate Algorithm]
    [Intermediate Algorithm]
    [Intermediate Algorithm]
    [Intermediate Algorithm]
    [Advanced Algorithm]
  • 原文地址:https://www.cnblogs.com/himonkey/p/11863321.html
Copyright © 2011-2022 走看看