3

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
slm
  • 369,824

1 Answers1

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
Zombo
  • 1
  • 5
  • 44
  • 63
  • 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 '18 at 15:51