c++ - Find and delete all core files in a directory -
core files generated when program terminates abnormally. consists working memory of system when program exits abnormally. can use debugger generated core file debug program. challenge is:
- delete core files directory (recursive search). core files quite huge in size , may want delete them save memory
- make sure don't delete folder named core , other filed named core not memory/system dump
after searching on internet, found nice piece of code this. drawback asks recognize core file make sure not other file named core. source : http://csnbbs.com/
code:
find . -name core\* -user $user -type f -size +1000000c -exec file {} \; -exec ls -l {} \; -exec printf "\n\ny remove core file\n" \; -exec /bin/rm -i {} \;
please post if have better solutions.
Comments
Post a Comment