Find and delete files using “find” shell command


Find and Delete Files in Linux/Unix:

Examples:

1) Find .log files in current directory and delete

$ find . -name “*.log” -type f -exec rm {} \;

2) Find the directories starting with ERO and delete

$ find -name “ERO*” -type d -exec rm {} \;

3) Find .log files in current directory and delete interactively

$ find . -name “*.log” -type f -exec rm -i {} \;

Tags: , ,

About Vaibhav

Friendly & Co-operative.

One response to “Find and delete files using “find” shell command”

Leave a comment