Add xstat func to get real creation time
This commit is contained in:
parent
815ad39809
commit
f72e008f94
11
zshrc
11
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
|
||||
|
|
Loading…
Reference in New Issue