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
0

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 '18 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.