From: Nicolas Boisselier Date: Mon, 8 Jun 2015 15:51:15 +0000 (+0100) Subject: find-sort-mtime X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=5d6d71c6ddca32e7add641ae8f7db96fc034b8f8;p=nb.git find-sort-mtime --- diff --git a/etc/bashrc.function b/etc/bashrc.function index 9bc6d541..5324d383 100644 --- a/etc/bashrc.function +++ b/etc/bashrc.function @@ -239,8 +239,12 @@ ls-tree() { } find-sort-mtime() { - #find $@ -type f -printf "%Tk\t%p\n" | sort -k1 -nr|cut -f2 - find $@ -type f -printf "%T@\t%p\n" | sed 's/^\([0-9]\+\)\.0\+/\1/'|sort -k1 -n | cut -f 2 | head + ( + case "$OSTYPE" in + darwin*) find $@ -type f -exec stat -f '%m %N' {} \; ;; + *) find $@ -type f -printf "%T@\t%p\n" | sed 's/^\([0-9]\+\)\.0\+/\1/' ;; + esac + ) | sort -k1 -n | cut -f 2 | head } nb-alert() {