The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Processing a log file based on date/time input and the date/time on the log file primp Shell Programming and Scripting 4 03-16-2008 08:23 AM
Unix File creation time tinivt Shell Programming and Scripting 2 01-23-2007 03:27 AM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 04:15 AM
file creation date & time alisevA3 UNIX for Dummies Questions & Answers 3 07-08-2005 02:21 AM
file creation time sskb UNIX for Dummies Questions & Answers 1 10-04-2001 09:03 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-14-2006
Registered User
 

Join Date: Feb 2006
Posts: 7
Question Listing the creation date/time of a file in unix

Hi,
I need the unix command which returns only the file name and its creation date/time in unix.

I tried ls -l <filename>. But that is giving other details also which I do not want.
Could anyone help me out?

Thanks.
Reply With Quote
Forum Sponsor
  #2  
Old 02-14-2006
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 156
This might serve your purpose.

ls -lrt | tr -s " " | cut -d" " -f6-9

Rahul.
Reply With Quote
  #3  
Old 02-14-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
Quote:
Originally Posted by rahulrathod
This might serve your purpose.

ls -lrt | tr -s " " | cut -d" " -f6-9

Rahul.
the time that is displayed is the modification time of the file

and i believe no where in the i-node file creation date/time would be stored
Reply With Quote
  #4  
Old 02-14-2006
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 156
Agree with you.

But creation time should be stored somewhere i beleive as the find command can get the files created on/before/after a particular date. Curious to know where this info might be available.

Rahul.
Reply With Quote
  #5  
Old 02-14-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
Quote:
Originally Posted by rahulrathod
Agree with you.

But creation time should be stored somewhere i beleive as the find command can get the files created on/before/after a particular date. Curious to know where this info might be available.

Rahul.
could you please let me know what is the option available in find to retrieve a file created before n days?

from the man pages of find with respect to time modification

Code:
-atime n
         True if the file was accessed n days ago.
Code:
-ctime n
        True if the file's status was changed n days ago.
Code:
 -mtime n
        True if the file's data was modified n days ago.
no where file creation date/time would be stored
Reply With Quote
  #6  
Old 02-15-2006
Registered User
 

Join Date: Feb 2006
Posts: 7
Quote:
Originally Posted by rahulrathod
This might serve your purpose.

ls -lrt | tr -s " " | cut -d" " -f6-9

Rahul.

This has helped. Thank you all for your support. Actually I wanted to access the modified date and time only.

I would anyhow find out whether it is possible to know the creation date and time of a file in unix and let you all know.

Thanks again.
Reply With Quote
  #7  
Old 02-15-2006
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 156
Code:
-ctime n
True if the file's status was changed n days ago.

Sorry,

I thought ctime was creation date. Just went by the name.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0