![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding the oldest file in a particular directory | pavan_movva | Shell Programming and Scripting | 4 | 04-08-2009 07:24 AM |
| Finding the oldest file | janet | Shell Programming and Scripting | 5 | 03-23-2009 10:31 AM |
| Find Oldest file in a directory tree | rahulrathod | Shell Programming and Scripting | 25 | 01-12-2009 12:45 PM |
| how to grep the oldest file in a directory | ericaworld | Shell Programming and Scripting | 1 | 05-29-2007 01:24 PM |
| Removing the oldest file in a directory | pavan_movva | Shell Programming and Scripting | 2 | 10-10-2006 11:38 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Oldest File In A Directory
I'm writing a script to find the oldest file in a directory. I know this can be done by using ls -rt | tail -1 but these are rather large directories and that can be somewhat slow since the script will be running constantly.
Are there any other ways to do this that would be faster? I looked to see if find would have any options but I didn't see anything. Any suggestions would be appreciated. Joel |
|
||||
|
I think that find is better that ls command.
example to find archives with more that 10 days and delete them : find /directore -mtime +10 -type f -exec rm {} \; or find / -mtime +10 -name "core" -type f -exec rm {} \; or another option with ls command : ls -r core* | xargs rm Witt |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|