Archive | March 2013

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 {} \;

Advertisements
%d bloggers like this: