Discussion: the newer of 2 files
Afficher un message
Vieux 27/05/2007, 13h28   #4
Daniel Rock
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: the newer of 2 files

osiris@abydos.kmt wrote:
> find (in the current directory tree) if the file with -name "old"
> is -newer than the file named "new""


find operates recursively. So if in any subdirectory a file with name
"old"/"new" is found this may also be printed.

If you just want to compare the two files you can compare them
directly with find:

find old -prune -newer new
find new -prune -newer old

No need for ".". -prune is needed if old/new is a directory instead of
a regular file. See example 6 in
http://www.opengroup.org/onlinepubs/...l#tag_04_55_17

Some shells also offer the test primaries -nt/-ot. But this is a
nonstandard extension, see
http://www.opengroup.org/onlinepubs/...#tag_04_140_18

--
Daniel
  Réponse avec citation
 
Page generated in 0,05333 seconds with 9 queries