File creation time in UNIX | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

File creation time in UNIX

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-25-2013
Balasankar Balasankar is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 14 May 2014, 10:20 AM EDT
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
File creation time in UNIX

Hi All,

Can any one help how to long list today's files in unix.i.e files which are have been created today should be able to "ls -ltr" .I should be able to apply the "ls -ltr" command on today's files(should not include all the files which were there in the directory).

Thanks in advance!!!

Last edited by Balasankar; 06-25-2013 at 06:24 AM..
Sponsored Links
    #2  
Old 06-25-2013
rangarasan's Avatar
rangarasan rangarasan is offline
Registered User
 
Join Date: Jul 2011
Last Activity: 30 April 2014, 6:04 AM EDT
Location: Chennai, India
Posts: 494
Thanks: 9
Thanked 124 Times in 120 Posts
find

Hey,

You could use the find command's mtime option to accomplish this task.


Code:
find /target/directory/ -type f -mtime -1 -exec ls -ltr {} \;

Cheers!!!
-R
Sponsored Links
    #3  
Old 06-25-2013
rbatte1 rbatte1 is offline Forum Staff  
Moderator
 
Join Date: Jun 2007
Last Activity: 26 July 2014, 5:24 PM EDT
Location: Lancashire, UK
Posts: 1,612
Thanks: 513
Thanked 274 Times in 245 Posts
The suggestion from rangarasan will be fine if you are searching for Modify Time. This can get a bit confusing though as the file may have been created some time ago, but modified today.

I don't think that there is a simple way to get creation time. You could look at the directory and that will have a timestamp when any file is created or deleted, but you won't know which. Perhaps you would have to write an audit type job to list the files off periodically and see what changes when.



Robin
Liverpool/Blackburn
UK
    #4  
Old 06-25-2013
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
 
Join Date: Mar 2005
Last Activity: 20 September 2013, 10:59 AM EDT
Location: Philadelphia metro
Posts: 958
Thanks: 3
Thanked 66 Times in 59 Posts
try this one ...

Code:
cd /dir
ls -lrt $(find . -type d -mtime 1 | egrep -v "[\.\.|\.]") | grep "Jun 25"

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
File creation time mastansaheb Red Hat 2 12-19-2012 04:21 AM
About Unix File creation time gaellafond UNIX for Dummies Questions & Answers 4 11-21-2011 11:02 AM
File creation time mr_manii Programming 2 08-28-2009 07:56 AM
Unix File creation time tinivt Shell Programming and Scripting 2 01-23-2007 05:27 AM
Listing the creation date/time of a file in unix unipepper Shell Programming and Scripting 6 02-15-2006 06:10 AM



All times are GMT -4. The time now is 10:24 AM.