≡ Menu

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

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… add one }
  • Chris F.A. Johnson June 22, 2009, 1:30 am

    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”

Security: Are you a robot or human?

Leave a Comment