-since option for ls -lt

Leo de Wit leo at philmds.UUCP
Fri Jun 17 23:27:28 AEST 1988


In article <355 at conexch.UUCP> root at conexch.UUCP (Larry Dighera) writes:
>In article <10981 at cgl.ucsf.EDU> seibel at hegel.mmwb.ucsf.edu.UUCP (George Seibel) writes:
  [lines deleted]...
  simple matter to get a listing of the files that have been changed within
  n days.  Try this:
   
          find . -ctime -n -exec ls -l {} \;
  
  Where n is the number of days.  Use -n to see all files newer than n-days
  old, and +n to see all files older n-days old.  You can also use all the
  other useful options to find like -type, -user, -size, ...
   
  There is a problem with this approach however, there's no way that I am aware
  of to prevent find from descending the directory tree.  There's yet another
  option that would be useful for find.

If you reverse the find and the ls, you get a much faster one:

         ls -l `find . -ctime -n -print`

Only one ls needed for all the files (the former solution fires up an ls for
each file that satisfies the condition); you could even use it to exclude
subdirectories, although find will do recursion:

         ls -l `find . -ctime -n -print|sed '/\/.*\//d'`

i.e. sed removes lines containing two or more /'s. Not to be recommended for
deep nesting!

	Leo.



More information about the Comp.unix.wizards mailing list