#!/usr/bin/env sh
# SPDX-License-Identifier: MIT
# ──────────────────────────────────────────────────────────────────────────────
# $source: cappysan-dotfile-xfce-scripts$
# ──────────────────────────────────────────────────────────────────────────────
#
# NAME
#      thunar-delete-empty-dirs - remove empty directories
#
# SEE ALSO
#      find(1)
#
# Restricted to a single argument via thunar-custom-actions configuration
#
set -eu -o pipefail

find "${@}" -type d -empty -delete || true
exec notify-send --urgency=low --expire-time=3000 --app-name=thunar --transient \
    --icon "$HOME/.local/share/icons/default/64x64/actions/folder-delete.png" \
    "Thunar action" "\nFinished removing empty directories ${@}"
