How to list files Created in last 2 hrs | 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 !!

How to list files Created in last 2 hrs

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-12-2004
rsonakiya rsonakiya is offline
Registered User
 
Join Date: May 2004
Last Activity: 13 May 2004, 9:59 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
How to list files Created in last 2 hrs

I wanted to know what command should I use to see the files created in last 2 hours in a given directory.

I know to see the files changed in last one day I can use this:
find /admin//dump -type f -ctime -1 -print | xargs ls -lt|pg

However I am not getting what should I use if I wanted tol ist all the files created in last 2 hours.

Thanks..

R
Sponsored Links
    #2  
Old 05-12-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 21 August 2014, 10:22 AM EDT
Location: Ashburn, Virginia
Posts: 9,919
Thanks: 59
Thanked 428 Times in 256 Posts
We have some rules here. One on them is:

(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting.

I have deleted your duplicates.
Sponsored Links
    #3  
Old 05-12-2004
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 20 August 2014, 11:31 PM EDT
Location: NM
Posts: 10,174
Thanks: 273
Thanked 784 Times in 733 Posts
Use touch to change a file data on a temp file in your directory
then use find.


Code:
cat "hi " >  t.tmp
# set the file time to 2 hours ago
touch -t 200405121120  t.tmp 
find /admin//dump -type f  -newer t.tmp -print -exec ls -lt {} \; | pg

    #4  
Old 03-02-2009
shivamdhawan shivamdhawan is offline
Registered User
 
Join Date: Mar 2009
Last Activity: 23 September 2009, 4:23 AM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
find /admin//dump -type f -newer t.tmp -print -exec ls -lt {} \; | pg

This looks good but I am not able to understand this command...can you explain it?
:?
Sponsored Links
    #5  
Old 03-02-2009
Whiteboard's Avatar
Whiteboard Whiteboard is offline
Registered User
 
Join Date: Feb 2009
Last Activity: 6 January 2011, 5:53 AM EST
Location: @........
Posts: 117
Thanks: 0
Thanked 0 Times in 0 Posts
t.tmp is a sample file that you are creating at 11.20 and then listing all the files after that particular time stamp... thats why you are using -newer t.tmp


You can modify the timestamp of a file using


Code:
touch -t yyyymmddhhmm filename

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
To list all the files created today with directory path meetusha.b UNIX for Dummies Questions & Answers 4 08-18-2008 05:53 AM
List files created before Noon 2 days prior prismtx Shell Programming and Scripting 3 01-19-2008 11:06 AM
command to list files that are created before some date csreenivas Solaris 3 06-27-2007 06:34 PM
How to list files with specific created date Draculla Filesystems, Disks and Memory 2 05-03-2007 11:45 PM
List Files & Folders created/modified tipsy Shell Programming and Scripting 2 10-24-2006 01:22 PM



All times are GMT -4. The time now is 02:02 PM.