【问题标题】:Gzip the file in unix more than 2 days在 unix 中压缩文件超过 2 天
【发布时间】:2021-08-04 20:41:01
【问题描述】:

我想对超过 2 天的文件进行 gzip,我有 3 个目录,我需要从该目录中使用 unix 脚本压缩 *log、*err、*out 文件,谁能帮助我。

【问题讨论】:

  • 仔细阅读find 的手册页。

标签: shell unix scripting


【解决方案1】:

类似的东西?

#!/bin/bash

GREEN="\e[32m"
ENDCOLOR="\e[0m"

cd dir
gzip -c *.log > logs.gz
gzip -c *.err > err.gz
gzip -c *.out > out.gz

echo -e "${GREEN}Done${ENDCOLOR}"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-13
    • 1970-01-01
    • 1970-01-01
    • 2022-09-29
    • 1970-01-01
    • 2017-03-27
    • 1970-01-01
    • 2019-09-13
    相关资源
    最近更新 更多