简体   繁体   English

Linux Shell:删除目录结构中的树中的所有HTML文件

[英]Linux Shell: remove all HTML files in tree while leaving directory structure

I'm trying to remove all .html files from the directory generated and from all subfolders there but it needs to leave all other files and directories alone. 我正在尝试从generated的目录和所有子文件夹中删除所有.html文件,但它需要保留所有其他文件和目录。

I tried going through folder by folder and running rm *.html but this takes a long time as there are 20+ subfolders which also have subfolders. 我尝试逐个文件夹并运行rm *.html但这需要很长时间,因为有20多个子文件夹也有子文件夹。 I tried looking the man pages for rm but nothing obvious jumped out. 我试图寻找该名男子页rm ,但没有明显的跳了出来。 I'm sure there's a way to do this in one shot but I don't know how. 我确信有一种方法可以一次性完成这项任务,但我不知道如何做到这一点。 Any ideas? 有任何想法吗?

我认为这可行:

cd generated

find . -type f -iname "*.html" -delete

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM