Hi
I think I mis-spoke in my last reply. I think the problem will arise if the first find command
doesn't remove any files.
That is, if nothing has been deleted or created in the temp folder within the specified time period, then the temp folder itself matches the timestamp criteria in the second find command.
Try repeating the test in your most recent post, but with 'temp' containing only files that have been updated recently and so don't get deleted by the first find command. I think you will see 'temp' get deleted.
I did another little test on my machine where I created a temp dir with some sub-dirs and a file. The file gets updated with some data, but note that this does not affect the timestamp of the temp dir because there was no file creation or destruction.
I then did a simplified version of the 'find -type d' command and you can see that it identified 'temp' as well as the old sub-dirs.
Here's the console text (I added spaces after the command outputs to ease reading)
Code:
drw1@coulthard:~$ ls -l temp
total 8
-rw-r--r-- 1 drw1 users 0 2007-02-13 08:33 afile
drwxr-xr-x 2 drw1 users 4096 2007-02-13 08:30 anotherdir/
drwxr-xr-x 2 drw1 users 4096 2007-02-13 08:30 yetanotherdir/
drw1@coulthard:~$ ls -ld temp
drwxr-xr-x 4 drw1 users 4096 2007-02-13 08:33 temp/
drw1@coulthard:~$ echo << EOF >temp/afile
> Some changes to afile
> EOF
drw1@coulthard:~$ ls -l temp
total 12
-rw-r--r-- 1 drw1 users 1 2007-02-13 08:35 afile
drwxr-xr-x 2 drw1 users 4096 2007-02-13 08:30 anotherdir/
drwxr-xr-x 2 drw1 users 4096 2007-02-13 08:30 yetanotherdir/
drw1@coulthard:~$ ls -ld temp
drwxr-xr-x 4 drw1 users 4096 2007-02-13 08:33 temp/
drw1@coulthard:~$ date
Tue Feb 13 08:37:33 EST 2007
drw1@coulthard:~$ find testdir -type d -mmin +3
testdir
testdir/defaultdir
testdir/otherdir
testdir/anewdir
drw1@coulthard:~$
As noted above, I think -mindepth 1 would fix this.