Find + prune + mtime

Hi,

i try to catch all files in a dir ,without going down in subdir , which don't have file extension and older than 10 days for example:

my dir :

drwxr-xr-x   7 notes01  notes          4096 Mar  8 14:11 .
drwxr-xr-x 116 root     system         4096 Mar  9 11:17 ..
-rw-r-----   1 notes01  notes            46 Apr  5 2006  .kshrc
-rw-r-----   1 notes01  notes            46 Apr  5 2006  .kshrc-02
-rw-------   1 notes01  notes            95 Jun 26 2007  .netrc
-rw-r-----   1 notes01  notes          1928 Feb 24 15:47 .profile
-rw-r-----   1 notes01  notes         38502 Oct 19 17:28 .rhosts
-rw-------   1 notes01  notes         15480 Mar  9 14:49 .sh_history
-rwxr-x---   1 notes01  notes          2689 Feb 26 2007  1st-distri.ksh
drwxr-x---   2 notes01  notes          8192 Mar  9 07:00 LOG
-rw-------   1 notes01  notes          1826 Feb  5 2009  alias.ksh
-rw-r-----   1 notes01  notes          8747 Feb 25 08:24 crontab-fevrier-2010
-rw-r-----   1 notes01  notes          8449 Feb 25 15:21 crontab-mars-2010
drwxr-x---   2 notes01  notes          4096 Mar  3 10:00 deleted_by
drwxr-x---   2 notes01  notes          4096 Feb 24 16:15 profile
drwxr-x---   2 notes01  notes          4096 Mar  2 17:06 save-crontab-ANC
drwxr-xr--   3 notes01  notes           256 Jan 30 2009  scripts
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test 2
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 toto

i want to have :

-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test 2
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 toto

so i test to use with find command the prune and mtime flag :

find . \( -type d ! -name . -prune \) -o \( -type f -mtime +10 -print \) -exec ls -al {} \;|grep -v '\./'|grep -v '\.'

it succeed if there is no mtime but with this flag the result is bad.

Can you help me please ?

Thanks
Christain

If Perl is acceptable:

perl -le'
print join $/, grep { 
  -f and -M > 10 and !/\./ 
  } glob "*"'

Otherwise:

find . ! -name . -prune -type f -mtime +10 |
  grep './[^.]*$'

With zsh:

print -l -- ^*.*(.m+10)

Thanks

find . ! -name . -prune -type f -mtime +10 | grep './[^.]*$'

works fine !

Can you tell me the use of "!" in find . ! -name . ?

and why replacing find . by th real path it doesn't work

find /users/notes01 ! -name . -prune -type f -mtime +10 | grep './[^.]*$'

regards
Christian

! tests for falseness:

Try with:

find /users/notes01/. ! -name ...

Basically, we're pruning (not descending) all directories not named . (a dot).

Hi

thanks for your help and explanations.

the last statement is quite ok :

<clazz023-notes01>/users/notes01 # find /users/notes01/. ! -name . -prune -type f -mtime +10| grep './[^.]*$'
/users/notes01/./crontab-fevrier-2010
/users/notes01/./crontab-mars-2010

i can use "cd /users/notes01

then

find . ! -name . -prune -type f -mtime +10| grep './[^.]*$'

regards
Christian