From 880277e86857e75168707001155180923b601756 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 31 May 2017 18:11:45 +1200 Subject: Add "downloads.sh" profile event Looks for ~/.downloads, checks each named dir, if there are any files in it, warns you once per dir including a count. This is to prompt me into sorting my downloads directory. --- sh/profile.d/downloads.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sh/profile.d/downloads.sh (limited to 'sh/profile.d') diff --git a/sh/profile.d/downloads.sh b/sh/profile.d/downloads.sh new file mode 100644 index 00000000..eb2a9b54 --- /dev/null +++ b/sh/profile.d/downloads.sh @@ -0,0 +1,13 @@ +[ -f "$HOME"/.downloads ] || return +( + while IFS= read -r dir ; do + case $dir in + '#'*) continue ;; + esac + [ -d "$dir" ] || continue + set -- "$dir"/* + [ -e "$1" ] || shift + [ "$#" -gt 0 ] || continue + printf 'You have %u unsorted files in %s.\n' "$#" "$dir" + done < "$HOME"/.downloads +) -- cgit v1.2.3