rm 匹配多个文件扩展名

rm 匹配多个文件扩展名

如何将这两个命令合并在一起

rm *.html
rm *.xml

答案1

简单地rm *.html *.xml

另请参阅Linux(或者苹果系统)或尝试末日审判当前输出如下:

$ tldr rm

rm

Remove files or directories.

- Remove files from arbitrary locations:
    rm path/to/file path/to/another/file

- Recursively remove a directory and all its subdirectories:
    rm -r path/to/folder

- Forcibly remove a directory, without prompting for confirmation or showing error messages:
    rm -rf path/to/folder

- Interactively remove multiple files, with a prompt before every removal:
    rm -i file(s)

- Remove files in verbose mode, printing a message for each removed file:
    rm -v path/to/folder/*

$

答案2

只需使用

rm *.html *.xml

是 shell 解释通配符模式来执行文件名扩展 - 而不是命令rm

答案3

如果您在接受答案时遇到错误,当没有 .html 文件时,您也可以像这样链接命令: rm *.html; rm *.xml

相关内容