participate


General Solaris 10 Discussion - How do I find the file creation date with out using ls and cut commands ?
<<   Back to Forum  |   Give us Feedback
This topic has 1 reply on 1 page.
sivaparam
Posts:31
Registered: 4/29/99
How do I find the file creation date with out using ls and cut commands ?   
Jul 3, 2007 6:03 PM

 
Hi
How do I find the file creation date with out using ls and cut commands ?

for example:
%filecrdate <name_of the_file>
2007-03-04
 
Darren_Dunham
Posts:4,021
Registered: 8/4/06
Re: How do I find the file creation date with out using ls and cut commands   
Jul 5, 2007 9:18 AM (reply 1 of 1)  (In reply to original post )

 
What files are you referring to?

Traditionally, UNIX files do not have a creation date. UFS on Solaris doesn't record or track any creation timestamp.

The timestamps on UNIX are access time, modification time, and inode change time.

You can grab and compile the 'stat' program to see them easily, or I might use 'perl' to view them.

# stat field 8 is atime, 9 is mtime, and 10 is ctime
%perl -le 'print scalar localtime ((lstat $ARGV[0])[9])' <name_of_the_file>

If you truly just want the date in that format, I'd go with:

% perl -MPOSIX -le 'print strftime "%Y-%m-%d",localtime ((stat $ARGV[0])[9])' <name_of_the_file>

--
Darren
 
This topic has 1 reply on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 26
  • Guests : 129

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums