#! /bin/zsh # # none of the below functions seem to # work satisfactorily, instead use # $ ls -clt FILE[S] file-birth () { local file=$1 local inode=$(ls -i $file | cut -d \ -f 1) local dev=$(df $file | (read a; read a b; echo $a)) debugfs -R 'stat <$inode>' $dev } file-edited () { local -a files files=($@) local now=$(date +%s) local secs local age local time_string local -a time_data local y local d local h local m local s local out for f in $files; do secs=$(\ls -d -l --time-style=+%s $f | cut -d \ -f 6) age=$(( $now - $secs )) time_string=$(units -t "$age s" time) time_data=("${(@s/;/)time_string}") y=$time_data[1] d=$time_date[2] h=$time_data[3] m=$time_data[4] s=$time_data[5] out="" out+=" ${age}s " [[ $y > 0 ]] && out+="${y}y " [[ $d > 0 ]] && out+="${d}d " [[ $h > 0 ]] && out+="${h}h " [[ $m > 0 ]] && out+="${m}m " [[ $s > 0 ]] && out+="${s}s" out+=" $f" echo $out done | sort -n -k 1 }