I want to extract creation date of a file and modification time. The format should be (yyyymmddhh24miss).

  • My unix shell /usr/bin/ksh
  • The file: file.txt
  • My system: SunOS 5.10 Generic_150400-23 sun4v sparc sun4v

1 Answer 1


I have found the solution:

perl -MPOSIX -l -e \
'print strftime "%Y%m%d%H%M%S", localtime((lstat)[9]) for @ARGV' file.txt
  • 1
    That is not the creation time, it's the time of last modification. Solaris does not, as far as I see, store the time of creation of files.
    – Kusalananda
    Jul 21, 2018 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .