Large deletes in Unix

If there are too many files to be deleted at once, the 'rm -f' command does not work. It throws up an error that states "/bin/rm: Argument list too long". So, here is a solution...

$find -name '*.txt' -exec rm -f {} \;

Here we find each entry that matches the pattern *.txt, and execute the command rm -f on it.
Courtesy: Thanks to my team lead for this tip.

Posted bySeshu Karthick at 12:20 PM