On Sat, 24 Jan 2009, Raymond Norton wrote: > Mike Miller wrote: >> On Sat, 24 Jan 2009, Raymond Norton wrote: >> >>> find /var/spool/MailScanner/quarantine -mtime +10 -type f -exec rm >>> -rf {} \; >>>>> >>>>> Remove the "-type f" >>>> >>>> Will the time stamp on a directory always be at least as new as the >>>> newest file in the tree within the directory? Apparently not -- I >>>> just checked it. I think you might mean that he should remove the >>>> "-type f" and also change the "-rf" to "-f". Look at this on your >>>> machine: >>>> >>>> ls -ld /home >>>> ls -ld /home/* >>>> >>>> See what I mean? >>>> >>>> Mike >>> >>> I ran this script for the first time last night >> >> What script are you talking about? Please be explicit because we made >> some recommendations and I don't know which ones you used. If ran the >> command shown on the first line above, then you were ignoring or >> misunderstanding what I wrote above. >> >> >>> and it looks like I ran into this very problem. Instead of leaving >>> folder 20 days old, it only left folders 8 days old. Is there another >>> way to modify the script to only remove folders 21 days or older? >> >> For testing purposes you can leave off the -exec and everything to the >> right of it. Try changing the directory and using different options, >> stuff like this to see the dates on directories: >> >> ls -ld $(find / -mtime +10 -type d) | less >> ls -ld $(find / -mtime +30 -type d) | less >> >> This is the script I am using: > > #!/bin/bash > mysql -ppassword mailscanner<<EOFMYSQL > delete from maillog where timestamp < date_sub(curdate(), interval 20 day); > EOFMYSQL > find /var/spool/MailScanner/quarantine -mtime +20 -exec rm -rfd {} \; What is the "-d" option to the "rm" command? It isn't in my "man rm" GNU documentation on Ubuntu 8.10. And, like I said earlier, you have to be really, really careful with the "-r" option to rm when you are doing this kind of thing. Try a few experiments without the exec to see how it is working for you before you delete things. Mike