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:

  1. delete core files directory (recursive search). core files quite huge in size , may want delete them save memory
  2. 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

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -