Tuesday, October 10, 2006

Find and Delete Files

Sometimes there is a requirement to find numerous file and then delete as they are found. One type of file that is commonly deleted is the core file. When something goes wrong with a program, the operating system generates it for debugging purposes. Normally, they are just deleted upon detection.

/usr/bin/find / -name core -type f -exec rm {} \;

You can replace the file named core with your specified filename. The "/" is the absolute path for root but you can replace it with any path name, e.g. /home/esofthub, /usr, /var/adm, /opt, /etc.

No comments: