| Advertise on warmetal.nl! Click for more information about advertising here. |
Did you find this website useful? Did I save you a lot of time? |
|
find /tmp/archive/. -type f -mtime +31 -exec rm {} \;
Note: If you have directories beneath the directories where you do your search take a look at the option -depth
find /tmp/archive/* -prune -type f -mtime +31 -exec rm {} \; /bin/sh: /usr/bin/find: Argument list too long
Turns out, find doesn't like '*', it needs the '.', as used in the example above.
To ignore a directory and the files under it, use -prune
But than, when I use the “find . -prune” prune will ignore the entire directory since '.' actually means the current directory. So to use this option you're forced to use '*':
find /var/data/* -prune -type f -name '*.txt2011*' -mtime +3 -print
Discussion