Discussion: the newer of 2 files
Afficher un message
Vieux 27/05/2007, 07h45   #2
wfw
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: the newer of 2 files

On May 27, 12:02 am, osi...@abydos.kmt wrote:
> I thought of a way to compare modification dates
> of two files in order to determine which is newer.
> The man page does not explain this.
> However, I'm not sure whether this is accurate:
>
> $ touch old
> $ touch new
> $ find . -name old -newer new
> <no output>
> $ find . -name new -newer old
> ./new
>
> I would have expected the first command to tell me
> that the file named "new" is newer
> yet I suspect that because "old" is not newer, there is no output.
> So I should interpret this comparison in the first example as:
>
> find (in the current directory tree) if the file with -name "old"
> is -newer than the file named "new""
>
> is that correct?
> Thanks.


No. The first command says

recursively descend "." and list files named 'old' AND that are newer
than 'new'.
There are none. The second swaps old and new and thus lists "new".

  Réponse avec citation
 
Page generated in 0,05855 seconds with 9 queries