diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-05-31 18:11:45 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-05-31 18:11:45 +1200 |
commit | 880277e86857e75168707001155180923b601756 (patch) | |
tree | c075284e4fc7b27c5d688eddb1f131cc1dccf8e3 | |
parent | Add an idea (diff) | |
download | dotfiles-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.
-rw-r--r-- | sh/profile.d/downloads.sh | 13 |
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 +) |