Delete all files whose filenames contain a particular string?
Use find
to recursively find and delete files with "text" in their names:
find -type f -name '*text*' -delete
You might also want run find -type f -name '*text*'
(without the -delete
) before that to make sure you won't delete any files you didn't intend to delete.
In fact, you can place wildcards anywhere in the search string, so -name '12_angry_men_lone_holdout-*.jpg'
might be more suitable in your case.
If they are in the same folder use * wildcard to achieve that:
rm *text*
Where text
is string that filename contains.