citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

open-dl (295B)


      1 #!/usr/bin/env bash
      2 
      3 set -e
      4 
      5 cd "${1:-$HOME/Downloads}"
      6 max_depth=${3:-1}
      7 
      8 out=$(find . -maxdepth $max_depth -name "*.${2:-pdf}" -type f -printf "%T@ %Tc %p\n" \
      9   | sort -nr \
     10   | cut -f2- -d" " \
     11   | dmenu -p docs -l 30 \
     12   | cut -f3- -d" ")
     13 
     14 if [ -z "$out" ]; then
     15     exit 1
     16 fi
     17 
     18 open "$out"