|
Directory : /scripts2/ |
#!/bin/bash
###############################################################################
# Large Backups Report
#
# Busca backups grandes y genera un reporte simple:
# archivo|bytes
###############################################################################
set -o nounset
set -o pipefail
############################
# Configuración
############################
THRESHOLD=4000000000 # ~4 GB
REPORT="/etc/sitioshispanos/large_backups_report.txt"
############################
# Inicialización
############################
mkdir -p "$(dirname "$REPORT")"
: > "$REPORT"
############################
# Procesamiento
############################
find /home \
-maxdepth 6 \
-type f \
\( \
-name "*.tar.gz" -o \
-name "*.zip" -o \
-name "*.wpress" -o \
-name "*.tar" \
\) \
-size +$((THRESHOLD / 1024 / 1024))k \
-not -path "/home/virtfs/*" \
-not -path "/home/*/mail/*" \
-print0 |
while IFS= read -r -d '' archivo; do
size=$(stat -c%s "$archivo") || continue
(( size > THRESHOLD )) || continue
fecha=$(stat -c %y "$archivo" | cut -d'.' -f1)
printf '%s|%d|%s\n' \
"$archivo" \
"$size" \
"$fecha" >> "$REPORT"
done
exit 0