How to get file creation date/time in Bash/Debian?

后端 未结 12 1756
有刺的猬
有刺的猬 2020-11-28 23:00

I\'m using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time. ls -lh a.txt and stat -c %y a.

12条回答
  •  既然无缘
    2020-11-28 23:34

    If you really want to achieve that you can use a file watcher like inotifywait.

    You watch a directory and you save information about file creations in separate file outside that directory.

    while true; do
      change=$(inotifywait -e close_write,moved_to,create .)
      change=${change#./ * }
      if [ "$change" = ".*" ]; then ./scriptToStoreInfoAboutFile; fi
    done
    

    As no creation time is stored, you can build your own system based on inotify.

提交回复
热议问题