Reason for no directory creation date

i read here that linux provides no way to determine when a directory was created.

https://www.unix.com/shell-programming-and-scripting/157874-creation-date-directory.html

I have a directory /home/andy/scripts that had a README file in it.

That file says

I put the script in that directory and in doing so, the directory Date Modified field changed to the time I put the script in that directory.

The script does NOT execute when my computer returns from a sleep state.

I was hoping to find if that directory was created when I installed Ubuntu.

Most file system types used on BSD, Linux, and UNIX systems do not save a timestamp indicating when a file was created (and a directory is one type of a "file"). If a frequently used file system type on your system does save file creation timestamps, there is probably an option on the ls utility on your system that will print files' creation dates instead of the last modification time of the file's contents (default), last modification time of the file's metadata ( -c option), or the last access time of the file ( -u option) when printing a long listing ( -l option).

You'll have to check the man page for ls on your system to determine whether or not your system provides such an option and what filesystem types support it, if it does.

1 Like

I wouldn't write most BSD, Linux and UNIX systems do not save a file creation time.

  • FreeBSD traditional file system is UFS2 and the trend is to switch to ZFS. Both of these file systems store the file creation time.
  • Linux default file system on many distributions is ext4 which stores file creation time too. Some alternatives like btrfs and ZFS do also store it.
  • OS X main file system is HFS Plus and it is transitioning to APFS, both store the creation time.
  • On the Unix side, Solaris, AIX, and HP-UX respectively default to ZFS, JFS, and VXFS. All three do store the creation time.

An exception is OpenBSD with FFS2.

Given the unfortunate lack of standard for this feature, the ways to retrieve that piece of information will vary depending on the OS. That might be ls , the non standard stat command, or something else.

3 Likes

Thanks for the replies. I deleted the directory when I discovered it was not used.