aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-05-31 18:11:45 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-05-31 18:11:45 +1200
commit880277e86857e75168707001155180923b601756 (patch)
treec075284e4fc7b27c5d688eddb1f131cc1dccf8e3 /sh
parentAdd an idea (diff)
downloaddotfiles-880277e86857e75168707001155180923b601756.tar.gz
dotfiles-880277e86857e75168707001155180923b601756.zip
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.
Diffstat (limited to 'sh')
-rw-r--r--sh/profile.d/downloads.sh13
1 files changed, 13 insertions, 0 deletions
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
+)