Quote:
Originally Posted by CRC123
I don't know if 'rm' command takes input from pipes.
Try this instead:
Code:
rm -rf `find ./ -name '*_1'`
or
Code:
rm -rf $(find ./ -name '*_1')
|
This can lead to potential problems, overall if the list is long enough.
BrianK's way is the correct one. Since find can do it all, let's use it. However, I would also add single quotation marks around the curly brackets:
Code:
find ./ -name '*_l' -exec rm -rfv '{}' \;
If you want to use pipes, use xargs:
Code:
find ./ -name '*_1' | xargs rm -rf
Or even
Code:
find ./ -name '*_1' | while read file; do rm -rf "$file"; done
Or even use redirection, however there's really no need to overcomplicate the things.