[SunHELP] find command

Will Mc Donald wmcdonald at ntlworld.com
Mon May 13 03:45:57 CDT 2002


You want to use +3 rather that -3, -3 is less than three days old. And use
mtime or ctime rather than atime. Using atime modifies the atime of
directories searched!

     -atime n        True if the file was accessed  n  days  ago.
                    The  access  time  of  directories in path is
                    changed by find itself.

So...

# find . -type d -mtime +3

All directories modified more than 3 days ago.

Will.

----- Original Message -----
From: "Simon Jespersen" <shj at pine.dk>
To: "Sun solaris help list" <sunhelp at sunhelp.org>
Sent: Monday, May 13, 2002 9:23 AM
Subject: [SunHELP] find command


> Hi list! yet antoher question
> Usually im ok with the find command, but this ones i cant figure out.
>
> I want to find all directories in a file structure that has been created
> more the 3 days ago, and then remove it. But i doesnt seems to work when i
> try
>
> find . -type d -atime -3
>
> If i do a ls -l on the filesystem they are all older than 3 days.
> drwxr-xr-x   3 mosaic   mosaic       512 Maj  8 13:17 Bundegrd
> drwxr-xr-x   8 mosaic   mosaic       512 Maj  1 16:47 fn
> drwxr-xr-x   2 mosaic   mosaic       512 Maj  6 15:17 gry
> drwxr-xr-x   2 mosaic   mosaic       512 Maj  1 16:47 LargeFiles
> drwxrwxrwx   5 nobody   nobody       512 Maj  6 14:57 mexico
> drwxr-xr-x   2 mosaic   mosaic       512 Maj  1 16:47 mos
> drwxr-xr-x   2 mosaic   mosaic       512 Maj  1 16:47 new test photos
> drwxr-xr-x   3 mosaic   mosaic       512 Maj  1 16:47 opgaver
> drwxr-xr-x   4 mosaic   mosaic       512 Maj  1 16:47 opgaver2
> drwxr-xr-x   2 mosaic   mosaic       512 Maj  1 16:47 Pc filer
>
>
> Does the atime not work with the" -type d" option



More information about the SunHELP mailing list