Recursively search for most recent modification


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Recursively search for most recent modification
# 1  
Old 04-17-2009
Recursively search for most recent modification

Hello all,

I'm trying to determine when the last time a file in a certain directory was modified. I don't care what file it is, I just want to know when it was last updated. So far I have

Code:
ls -aRl --full-time --sort=time

which is close. The problem is that it only sorts within folders, not within the entire directory. How can I determine when the last file was modified?
# 2  
Old 04-17-2009
Figures. I spend an hour trying to find an answer and as soon as I post, I find it:

Code:
find . -type f -printf "%TY-%Tm-%Td %TT\n" | sort -rb

However, I don't know how to just limit it to one line. Any thoughts on that piece?
# 3  
Old 04-17-2009
Code:
find . -type f -printf "%TY-%Tm-%Td %TT\n" | sort -rb | head -1

It's just one of those days...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to recursively copy directory only for recent files?

I love the -newerct flag for the Cygwin find command on windows. Can I use "/usr/bin/find . -newerct '3 hours ago'" to conditionally copy a directory tree so that only the files in the directory tree that are younger than 3 hours are copied to my destination directory such that the directory... (4 Replies)
Discussion started by: siegfried
4 Replies

2. Shell Programming and Scripting

Search/Replace in multiple files recursively

Hi there, I am using AIX and trying to search and replace a string with another string in multiple files in different directories. I wanted to search replace in steps so I don't change all of the instance anywhere in the server at once, minimizing impact. STEP 1: -------- I first searched... (5 Replies)
Discussion started by: zaino22
5 Replies

3. UNIX for Advanced & Expert Users

Recursively search the string from a column in no. of files

i have a file named keyword.csv(contains around 8k records) which contains a no. of columns. The 5th column contains all the keywords. I want to recursively search these keywords in all .pl files(around 1k) and display the filename....Afterthat i will use the filename and some of the column from... (3 Replies)
Discussion started by: millan
3 Replies

4. Linux

Search files recursively

grep pattern filename To search for the pattern in all files in the current directory and the sub-directories recursively, what needs to be substituted in filename? (1 Reply)
Discussion started by: ravisingh
1 Replies

5. Shell Programming and Scripting

sed -s does not search recursively

I would like to export the 5th line from every file within a directory. I am using GNU sed because we have no Unix or Linux environment. I used the following statement: sed -s -n 5p c:\directory\*.* but I only get the 5th line from one of the files in the directory. I am desperate for a... (1 Reply)
Discussion started by: hollingv
1 Replies

6. Shell Programming and Scripting

Print a Search Pattern after modification

Using either vim or awk or sed If I wish to to search for an unknown pattern - lets say 1B2495 or 1Q2345 so Search pattern : 1 and replace the 1 with 2 to print out : 2B2495 or 2Q2345 what are the possible commands. Struggling here - help would be appreciated. (5 Replies)
Discussion started by: dpooleco
5 Replies

7. Solaris

search for date of modification

hi member. i want to know all file in the system which the last date of modification = 14-06-2010 for example what can i do (4 Replies)
Discussion started by: xxmasrawy
4 Replies

8. Shell Programming and Scripting

How to recursively search and destroy tabs

Inspite of my best efforts, eclipse 3.5 seems to continue to misbehave and insert tab characters in my source code. How do I write a script execute from emacs to search all my files for tab characters and conveniently position me on the line of code that has the offending tab? Here are my... (7 Replies)
Discussion started by: siegfried
7 Replies

9. Shell Programming and Scripting

sed search and replace recursively

Hi, I tried making a shell script which recursively search in a given directory for all files *.txt and then search and replace some text and after that save each file as $filename.dynamips.txt I would like to get this done with sed. I tried but couldn't get it to work. BTW this is not... (1 Reply)
Discussion started by: 2bone
1 Replies

10. UNIX for Dummies Questions & Answers

Search by modification date

Hi I'd like to know if is it possible to find files given a certain modification date (say, 01-05-2006, that's 1st of May 2006) I can calculate the days backward: find / -ctime 23 but I wish to search by exact modification day Thanks (5 Replies)
Discussion started by: slink
5 Replies
Login or Register to Ask a Question