Skip to main content
4 of 5
deleted 53 characters in body
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k

You can use a bash script to do it:

#!/bin/bash # Don't screw us up with spaces! IFS=$'\n'; set -f DIRS=$(find . -type d -name "rules") for i in $DIRS; do set +f rm $i/*.pdf done set +f 

This iterates through the directories you find in your find command and removes the pdf's under each directory.

The line IFS=$'\n' is to cope with spaces in file names, and set -f is to cope with wildcard characters. Of course, this is assuming you don't have newlines in any of your filenames. If you do, the solution will become a lot more complicated.

dma1324
  • 107
  • 4