From f72e008f94916db5a2c09bd890c5a74fa0127d46 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 9 Aug 2021 10:01:58 +0200 Subject: [PATCH] Add xstat func to get real creation time --- zshrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zshrc b/zshrc index d86d156..b4d1e0e 100644 --- a/zshrc +++ b/zshrc @@ -1383,6 +1383,17 @@ v() { fi } +# Try to give the real creation time of a file +xstat() { + for target in "${@}"; do + inode=$(ls -di "${target}" | cut -d ' ' -f 1) + fs=$(df "${target}" | tail -1 | awk '{print $1}') + crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null | + grep -oP 'crtime.*--\s*\K.*') + printf "%s\t%s\n" "${crtime}" "${target}" + done +} + # PDF with fzf {{{ # pdf - fuzzy open with "${PDF_VIEWER}" from current directory # cd into the directory of the selected file