How to delete files containing a character or number/digit in their filename on Linux or Unix

 
find . -type f -name "*[0-9]*" -delete

Explanation:

  • find .: Find files in the current directory.
  • -type f: Find only files (not directories).
  • -name "*[0-9]*": Find files whose names contain a digit.
  • -delete: Delete the files found.

Leave a Comment