add function crtime

This commit is contained in:
Jakobus Schürz 2020-12-05 19:01:17 +01:00
parent 00f3537187
commit 023d0a036d

View file

@ -886,4 +886,14 @@ EOF
rescan_scsi () { rescan_scsi () {
echo "- - -" > /sys/class/scsi_host/host0/scan echo "- - -" > /sys/class/scsi_host/host0/scan
} }
get_crtime() {
for target in "${@}"; do
inode=$(stat -c %i "${target}")
fs=$(df --output=source "${target}" | tail -1)
crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null |
grep -oP 'crtime.*--\s*\K.*')
printf "%s\t%s\n" "${target}" "${crtime}"
done
}
#EOF #EOF