我试图编写一个命令,从当前目录及其所有相关的子目录递归地删除具有不同扩展名(* .extension1,* .extension2等)的几个文件。
I am trying to write a command to remove recursively several files with different extensions (*.extension1, *.extension2 etc) from the current directory and all its related sub-directories.
到目前为止,我从,但我不能锻炼如何适应它在同一命令行中的多个文件:
So far I got this command from another post but I couldn't workout how to adapt it to more than one file in the same command line:
find . -name "*.extension1" -type f -delete是否如下简单? p>
Is it as simple as below?
find . -name "*.extension1";"*.extension2" -type f -delete这些都是我不需要的输出文件,但并不是所有输出文件都必须始终输出,因此有些扩展名可能不存在。这只是一个普通的清理命令。
Just as a side note, these are all output files that I do not need, but not all are necessarily always output so some of the extensions might not be present. This is just as a general clean-up command.
推荐答案find . \( -name "*.extension1" -o -name "*.extension2" \) -type f -delete
find文件(-name .py-o -name .html)--exec文件{} \;
find Documents ( -name ".py" -o -name ".html" ) -exec file {} \;
OR
find . -regextype posix-egrep -regex ".*\.(extension1|extension2)$" -type f -delete更多推荐
如何递归删除具有不同扩展名的多个文件?
发布评论