dotfiles/home/user/.local/bin/cleanup-directory-log
2025-11-05 22:17:50 +03:00

23 lines
410 B
Bash
Executable File

#!/bin/sh
set -eu
directory="$(realpath "${1}")"
readonly directory
if [ ! -d "${directory}" ]; then
echo "Directory '${directory}' not found" >&2
return 1
fi
readonly log_file="${directory}/cleanup.log"
if [ -n "${DRYRUN}" ]; then
log_file="/dev/null"
fi
touch "${log_file}"
echo "$(date -Iseconds) : Start cleanup" >> "${log_file}"
cleanup-directory "${directory}" | tee -a "${log_file}"