Search and delete files in Unix |
|
|
This is a useful tip to find and remove some files by searching recursively in a directory and sub directories
This will list down all the *.tmp/*.log files find . -type f -name "*.tmp" -exec echo {} \; find . -type f -name "*.log" -exec echo {} \;
This will delete down all the *.tmp/*.log files find . -type f -name "*.tmp" -exec rm {} \; find . -type f -name "*.log" -exec rm {} \;
It will be better to list the files first and then delete them, so that we do not miss out any important file
|