1

I want to search a certain directory (e.g. Desktop) to see if any files have been modified since they were last read. If modified files were found, I want to display the files' names, modified dates, and modified lines. Or display "No Modified Files Found" if none were found.

I know the following code

 $ find /home/you/Desktop stat

will display all modified files, but how do you display the modified dates and modified lines of the file?

Also, is there a way to do the same thing, without the "find" command? For example, with the ls command?

Ken White
  • 123,280
  • 14
  • 225
  • 444
Luke Ford
  • 19
  • 2
  • Check the `find` manpage, it has the `-mtime` option or the `-newer` option; pick what ever works best for you. Guess it boils down how you remember "last read". – Robert Apr 06 '16 at 02:05

1 Answers1

0

Use a variation of this

find ./  -mtime -60 -print | xargs stat -t "%c" 

stat, depending on system can use the same formatting rules as strftime.

To answer this...

I want to display the files' names, modified dates, and modified lines

You either need to have copies from the last edit or the files need to be in something like Git or SVN.

Harry
  • 11,298
  • 1
  • 29
  • 43