How to list today's files | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

How to list today's files

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-27-2006
berlin_germany berlin_germany is offline
Registered User
 
Join Date: Nov 2006
Last Activity: 30 July 2007, 10:16 AM EDT
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
How to list today's files

Hi,

I am trying to list names of only today's files OR say, files which are not older than 1 hour and copy them in 'list.txt' file. I know,
:ls > list.txt will list all the files. But, how to list today's files? Any help will be appriciated.
Sponsored Links
    #2  
Old 11-27-2006
ziminski ziminski is offline
Registered User
 
Join Date: Mar 2006
Last Activity: 12 March 2008, 2:59 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
here's a start
find ./ -depth -type f -ctime -1 -print > LIST

man find and check out ctime

Rick
Sponsored Links
    #3  
Old 11-29-2006
dhanamurthy dhanamurthy is offline
Registered User
 
Join Date: Jun 2006
Last Activity: 1 October 2008, 10:29 AM EDT
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
This should help

find . -atime -2
    #4  
Old 11-29-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
 
Join Date: Mar 2005
Last Activity: 5 July 2014, 11:14 AM EDT
Location: classification algos
Posts: 3,203
Thanks: 19
Thanked 30 Times in 27 Posts
from man find,


Code:
 -atime n
              File was last accessed n*24 hours ago.


Will -atime 2 be exact to retrieve today's file ?

I think -atime 0 would do.
Sponsored Links
    #5  
Old 11-29-2006
dhanamurthy dhanamurthy is offline
Registered User
 
Join Date: Jun 2006
Last Activity: 1 October 2008, 10:29 AM EDT
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
-atime 2 retrieves exactly files accesed before two days. But -atime -2 retrieves files that were accessed in less than two days even 1 one day.

Hope this will help

find . -atime -1 > file_name

lists files accessed less than a day. Let us know if this helps
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
how to list all the files for today in the dir ajaypatil_am Shell Programming and Scripting 19 12-02-2011 08:09 AM
To list all the files created today with directory path meetusha.b UNIX for Dummies Questions & Answers 4 08-18-2008 06:53 AM
How to list all the files which are not generated today redlotus72 UNIX for Dummies Questions & Answers 2 10-05-2007 10:27 AM



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