我想要做的是遞歸刪除所有的HTML文件,省略template.html
和list.html
?Bash - 找到並刪除所有的HTML文件,但選定的一個
到目前爲止,我有下面的代碼,但我不知道如何設置這2個文件名的例外。
find . -name "*.html" -exec rm -rf {} \;
我想要做的是遞歸刪除所有的HTML文件,省略template.html
和list.html
?Bash - 找到並刪除所有的HTML文件,但選定的一個
到目前爲止,我有下面的代碼,但我不知道如何設置這2個文件名的例外。
find . -name "*.html" -exec rm -rf {} \;
你可以做到這一點!
find . -type f \(-iname "*.html" ! -iname "template.html" ! -iname "list.html" \) -exec rm -rf {} \;
使用 - 不是:
find . -name "*.html" -not -name template.html -not -name list.html -exec rm -rf {} \;
嘗試以下操作:
find . -type f -iname \*.html ! -iname template.html ! -iname list.html -exec rm -f -- {} +