#!/bin/bash

read -p "Enter directory path: " directory
read -p "Enter id of first log to remove: " id

find $directory -maxdepth 1 -type f -name '[0-9]*' | while read file; do
    filename=$(basename "$file")
    numbers=$(echo "$filename" | grep -oE '[0-9]+')
    for number in $numbers; do
        if [[ $number -gt id ]]; then
            rm "$file"
        fi
        break
    done
done
