From adea5a27bb81bb72f04b8b0fa7681fa9ec1d0c06 Mon Sep 17 00:00:00 2001 From: thek4n Date: Mon, 6 Oct 2025 15:00:57 +0300 Subject: [PATCH] fix cleanup-directory function --- home/user/.config/zsh/functions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/home/user/.config/zsh/functions b/home/user/.config/zsh/functions index d048278..06498b4 100644 --- a/home/user/.config/zsh/functions +++ b/home/user/.config/zsh/functions @@ -97,16 +97,16 @@ cleanup-directory() { if [ -n "${DRYRUN}" ]; then echo "Deleting files not accessed for a ${age} days:" - find "${directory}" -atime "${age}" + find "${directory}" -mindepth 1 -atime "${age}" -not -type d -not -name cleanup.log echo "Deleting empty directories:" - find "${directory}" -type d -empty -print + find "${directory}" -mindepth 1 -type d -empty else echo "Deleting files not accessed for a ${age} days:" - find "${directory}" -atime "${age}" | xargs -r rm -fv + find "${directory}" -mindepth 1 -atime "${age}" -not -type d -not -name cleanup.log -print -delete echo "Deleting empty directories:" - find "${directory}" -type d -empty -print | xargs -r rmdir + find "${directory}" -mindepth 1 -type d -empty -print -delete fi }