Some time it is necessary to find out files and remove them as we need to do today. However, rm command does not support search criteria.
However, with find command you can search for files in a directory and remove them on fly.
You need to combine find and rm command together.
Fortunately find command makes this operation quite easy.
You can use find command as follows:
find . -type d -print | grep <file_name/dir_name> | xargs -n1 rm -rf
No comments:
Post a Comment
Please provide valuable comments and suggestions for our motivation. Feel free to write down any query if you have regarding this post.