Skip to main content
3 of 5
added 16 characters in body
dma1324
  • 107
  • 4

You can use a bash script to do it:

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

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

EDIT: This would fail upon encountering a directory with whitespace in its name. To fix that, add the line IFS=$'\n' to the beginning of the file, as shown above.

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