1. 程式人生 > >shell-zip備份上個月的日誌(目錄)

shell-zip備份上個月的日誌(目錄)

#!/bin/bash

last_month=$(date -d "$(date +%Y%m)01 last month" +%Y%m)

echo $last_month

cd /PTAH

file=$(ls -d $last_month*)

zip -qrv /log/bak/$last_month.zip $file