find tool patterns


These are few find patterns I find useful in a daily work.
The ones below were of great help when I had to clean Esafe that had more than 100,000 files in the spool ! So usual shell wild-card expansion didn't work (try to do ls in a folder with 130000 files ;). I sorted and then removed files by date - files created last 24 hours per remove.

        find . -mtime 0 -exec rm -f {} \;  
        find . -mtime 0 # find files created/modified within the past 24 hours  
        find . -mtime -1 # find files created/modified within the past 0 - 24 hours  
        find . -mtime 1 # find files modified between 24 and 48 hours ago  
        find . -mtime +1 # find files modified more than 48 hours ago  
        find . -mmin +3 -mmin -10 # find files modifed between 4 and 9 minutes 

Default is  logical AND between clauses
NB the -regexp switch to the find looks for a complete match !
Finding by permission pattern and then removing:
- Find files that have at LEAST following permissions set
find . -type f -perm -0750 -exec rm -f {} \;
- Find files with ANY of the permissions set:
find . -type f -perm +0750 -exec rm -f {} \;
- Find files with pattern EXACTLY matching :
find . -type f -perm 0750 -exec rm -f {} \;
- Find by UID filetype and size:
find . -type f -uid 0 -size +2k -exec ls -l {} \;
modifiers to size switch: b w k c