This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: find -newer problem


On Mon, 27 Jun 2005, Allan WIlkins wrote:

> I must apologise if this is an already known problem but I have been
> unable to locate any reference to it in the mail archives.
>
> Executing a find using the -newer parameter returns files that appear to
> be of the same age. e.g.
>
> $ find XXX -newer YYY
> XXX
> $ ls -l XXX YYY
> -r--r--r--  1 allanw Domain Users 10291 Jun 27 10:38 XXX
> -r--r--r--  1 allanw Domain Users  5865 Jun 27 10:38 YYY
> $ ls -lu XXX YYY
> -r--r--r--  1 allanw Domain Users 10291 Jun 27 00:00 XXX
> -r--r--r--  1 allanw Domain Users  5865 Jun 27 00:00 YYY
> $ ls -lc XXX YYY
> -r--r--r--  1 allanw Domain Users 10291 Jun 27 12:21 XXX
> -r--r--r--  1 allanw Domain Users  5865 Jun 27 12:21 YYY
>
> However:
> $ touch AAA BBB
> $ find AAA -newer BBB
> $ ls -l AAA BBB
> -rw-r--r--  1 allanw Domain Users 0 Jun 27 12:11 AAA
> -rw-r--r--  1 allanw Domain Users 0 Jun 27 12:11 BBB
> $ ls -lc AAA BBB
> -rw-r--r--  1 allanw Domain Users 0 Jun 27 12:11 AAA
> -rw-r--r--  1 allanw Domain Users 0 Jun 27 12:11 BBB
> $ ls -lu AAA BBB
> -rw-r--r--  1 allanw Domain Users 0 Jun 27 00:00 AAA
> -rw-r--r--  1 allanw Domain Users 0 Jun 27 00:00 BBB
> So if the files are created using touch the find does not return anything.
>
> I understand that ls -l displays the last modification time. Is the find
> using the same date?

find *is* using the same date, but you may be running into filesystem
granularity issues.  FAT, for example, stores dates with the granularity
of 2 seconds.  You may also want to try "test AAA -nt BBB" and "test BBB
-nt AAA", to see whether you get results that are consistent with "find".

> Thanks in advance
> Al
>
> The output of a cygcheck -s -v -r > cygcheck.out follows
> ====================================================
> [snip cygcheck output]
> [snip *another* cygcheck output]

In the future, please *attach* the output of "cygcheck -svr" instead of
including it in-line.  It cuts down on false positive matches in archive
searches.

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]