I am trying to find
and delete files in current directory and subdirectories (recursively) which match different patterns and print the matching files to stdout
to know which ones are deleted.
For example I want to match all files starting with '&' and all files starting and ending with '$'.
I've tried using:
find . -type f -name '&*' -or -type f -name '$*$' -exec rm -v {} \;
but rm
apply only on the last match ('$*$').
Thus i've tried :
find . -type f -name '&*' -or -type f -name '$*$' -delete
But this not only match only the last pattern but it doesn't output the deleted files.
I know I can do this:
rm -v ``find -type f -name '&*' -or -type f -name '$*$'``
but I would really like to avoid this kind of approach and do it with find
command.
Any tips?
Thanks in advance.