From 130b243be3f82978b4cc72b9c3a9a0ec274b5b8d Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 9 Oct 2025 06:54:36 -0700 Subject: [PATCH] Add method to clean up hidden trashed files, usually from Android. --- tasks/general/acct_mgmt/users.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index 08a51f1..e7e243c 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -283,6 +283,19 @@ alias edit-config-wrk="sudo $EDITOR {{ wrk_file }}" alias edit-config-mnr="sudo $EDITOR {{ mnr_file }}" alias edit-config-srv="sudo $EDITOR {{ srv_file }}" + function_clean_trashed: | + function clean-trashed { + dir="$1" + if [[ -z $dir ]]; then + dir="./" + fi + cd $dir + dir="`pwd`" + echo "Removing '.trashed*' files in '$dir'." + find "$dir" -name ".trashed*" -exec du -h {} \; -delete + } + alias trashed-cleanup="clean-trashed" + alias trashed-clean="clean-trashed" function_check_trash: | function check-trash() { unset OPTIND @@ -378,6 +391,9 @@ fi echo "Checking but not cleaning /var/mail..." du -ha /var/mail | sort -h + if [[ $clean == "Y" ]]; then + clean-trashed "~/" + fi return 0 } alias check_trash="check-trash" @@ -895,6 +911,7 @@ {{ metasploit_aliases }} {{ show_config_aliases }} {{ edit_config_aliases }} + {{ function_clean_trashed }} {{ function_check_trash }} {{ function_clean }} {{ function_flatpak_usage }}