# How to get file creation time?

**URL:** <https://discourse.julialang.org/t/how-to-get-file-creation-time/6050>\
**Category:** New to Julia\
**Created:** [September 23, 2017, 6:39pm UTC](https://discourse.julialang.org/t/how-to-get-file-creation-time/6050 "2017-09-23T18:39:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wrgr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wrgr/32/2796_2.png) [@wrgr](https://discourse.julialang.org/u/wrgr)\
**Post date:** [September 23, 2017, 6:39pm UTC](https://discourse.julialang.org/t/how-to-get-file-creation-time/6050/1 "2017-09-23T18:39:29Z")

</div>

Does anybody know how to get file creation time in Julia 0.6?  
I’ve tried several options, `ctime()` returns change time, and in most cases is equal to `mtime()`, similarly behave `stat().mtime` and `stat().ctime`. In documentation, for some reason, `stat()` ctime is wrongly called creation time, but in reality behaves as change time.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 23, 2017, 8:43pm UTC](https://discourse.julialang.org/t/how-to-get-file-creation-time/6050/2 "2017-09-23T20:43:54Z")

</div>

At least on Linux, creation time isn’t very common (hopefully situation improved nowadays with ext4 and btrfs), are you sure your file system supports creation time at all?

---

<div class="post-metadata">

**Author:** ![wrgr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wrgr/32/2796_2.png) [@wrgr](https://discourse.julialang.org/u/wrgr)\
**Post date:** [September 24, 2017, 5:58am UTC](https://discourse.julialang.org/t/how-to-get-file-creation-time/6050/3 "2017-09-24T05:58:48Z")

</div>

Clearly yes, both `stat` command line returns **atime** , **mtime** and **ctime** AND **creation time** , and Get Info in Finder also shows correct creation and modification times.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 24, 2017, 11:09am UTC](https://discourse.julialang.org/t/how-to-get-file-creation-time/6050/4 "2017-09-24T11:09:20Z")

</div>

This page on [creation time in Python](https://stackoverflow.com/questions/1408272/get-file-creation-time-with-python-on-linux) is helpful. It’s possible to access it via the `stat` call on MacOS and some other BSD systems, but accessing it on Linux (even if the filesystem supports it) is more difficult.

The Julia high-level `stat` call doesn’t support this info (presumably because it is not portable), but you could use `ccall` on MacOS to call [the `stat` function](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man2/stat.2.html) yourself.
