Behaviour of "find" command

Hi,

I'm trying to understand why the find command below is not listing a directory which was modified long back from the number of days specified in the mtime part. :confused:

user-aster :/mydir
$ ls -ld 1607570a-4fed44bb-4988
drwxr-xr-x  3 xyz abc 4096 Jun 29 01:02 1607570a-4fed44bb-4988
user-aster :/mydir
$ find . -type d -mtime +14
./1607570a-4fe95e03-14fb
./1607570a-4fe95e03-14fb/.mdir
user-aster :/mydir
$ uname -a
Linux aster 2.6.9-100.ELsmp #1 SMP Tue Feb 1 12:17:32 EST 2011 i686 i686 i386 GNU/Linux

If you see above, the directory "1607570a-4fed44bb-4988" doesn't show up in the find command. Can anyone point out why this is happening?

Thanks in advance.

ls -ld 1607570a-4fed44bb-4988
drwxr-xr-x 2 xxxx xxxx 40 Jun 29 01:02 1607570a-4fed44bb-4988

find . -mtime +13 -type d
./1607570a-4fed44bb-4988

Thanks in2nix4life!
But why does having 13 in mtime giving the correct output, when its 14 days past the file creation.

The find command is a funky animal and its functionality seems to vary from OS-to-OS. I've found that if I need it to list data that is X days old, it seems to work if you subtract 1 from the real amount.

two points -

I disagree with in2nix.
find's behavior is largely very consistent, expecially on versions of UNIX that are POSIX-compliant.

find uses the stat() system call. This returns mtime as seconds since Jan 01 1970, called 'epoch seconds'. mtime +13 means the file's modification time is greater than the number of seconds in a day times 13 - at least (84600 * 13) seconds ago.
Not actual calendar days.

This result for find is from the CURRENT TIME. The time right now in epoch seconds. If you want find to behave the way you think about dates you have to give those it kinds of dates/times in the form of an mtime you set on a dummy file

So, -mtime +days ain't gonna cut it.
touch -t YYYYmmddhhmm [somefilename] sets an exact mtime on a file
example:

touch -t 20120628000  dummy  # midnight june 28
find /path/to/files -type d ! -newer dummy  -exec ls -ld {} \;