#!/bin/bash EXTENSION="*.log" DIRECTORY="/path/to/directory" find "$DIRECTORY" -name "$EXTENSION" -type f -exec rm -f {} \; echo "All log files have been deleted."