Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何删除文件夹中的所有内容并排除特定文件夹和文件?
(例如 tar: tar --exclude="folder")。
tar --exclude="folder"
编辑:我可以删除文件和文件夹。
注意:小心运行以下命令。
find . -type 'f' | grep -v "NameToExclude" | xargs rm find . -type 'd' | grep -v "NameToExclude" | xargs rmdir