更新时间:2022-11-28 16:41:45
Using bash, one option would be to use globstar
like this:
shopt -s globstar # enable the shell option
echo **/*.????? # to test which files are matched
rm **/*.????? # if you're happy
The pattern matches any files in the current directory or any subdirectories that end in a .
followed by 5 characters.
Rather than matching any character with a ?
, you could go more specific by changing the glob to something like **/*.[[:alnum:]][[:alnum:]][[:alnum:]][[:alnum:]][[:alnum:]]
to match 5 alphanumeric characters.