Recursively Deleting

I needed a quick command to delete a specific file or directory that existing in multiple subdirectories. Here is what I came up with.

find . -name “filename” | xargs rm -rf

Note: files can be a filename or directory name. You can use rm with -rf or without

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.