Shell Script To Read File Date – Last Access / Modification Time

Posted on in Categories File-management last updated October 1, 2008

A shell script to display file date in following format:

+ Time of last access
+ Time of last modification
+ Time of last change

Please note that UNIX / Linux filesystem never stores file creation date / time stamp.

This script use stat command to find out information about file date and time using custom field format.

1 comment

  1. This script contains three calls to stat (when one would do) all of which will fail if the filename contains spaces.

    It will also fail if the version of stat takes a different syntax (as the *BSD version does).

    stat -c ‘Time of last access : %x
    Time of last modification : %y
    Time of last change : %z’ “$file”

Leave a Comment