If you try to remove some file and recive that error. Then one solution is to combine find with xargs.
find . -name ‘spam-*’ | xargs rm
This will send one line to the rm command.
If the filenames involved have spaces, you will need to do use find’s
“-print0” option in conjunction with xargs’s “-0” option. otherwise the
shell that xargs uses to execute the “rm” command line will treat the
space as a token separator, thereby treating the name as two (or more)
names, none of which are the thing you’re trying to actually delete.
the command line should look like this…
find . -name ‘spam-*’ -print0 | xargs -0 rm