How to exclude a hidden folder from being deleted

This question already has an answer here:

  • How to exclude a directory in find . command 32 answers

  • Use ! -name '.git' ! -name '.git' :

    find . -mindepth 1 ! -path '*testResults*' ... ! -name '.git' ...
    

    The fact that you use ! -path ! -path but don't know about ! -name ! -name shows that you just pick some random stuff from the internet instead of looking at the right place of information: The man page! So just go ahead and type:

    man find
    
    链接地址: http://www.djcxy.com/p/78132.html

    上一篇: 修剪'选择'找到'sh?

    下一篇: 如何排除隐藏文件夹被删除