[英]How to delete files from specific folders in linux?
So, I have a requirement to delete all files from specific folders within a directory.因此,我需要从目录中的特定文件夹中删除所有文件。 These are folders that end with "-outputs" in their names and I need to delete all files in those particular folders.
这些文件夹的名称以“-outputs”结尾,我需要删除这些特定文件夹中的所有文件。
Is there a command in linux that lets you do that? linux中是否有一个命令可以让你这样做?
You can execute the following command:您可以执行以下命令:
rm $YOUR_PATH\*-outputs
Change $YOUR_PATH to the path where the files are located.将 $YOUR_PATH 更改为文件所在的路径。
If you want to ignore nonexistent files and arguments, and avoid the prompt, you can use the -f option.如果您想忽略不存在的文件和参数,并避免出现提示,您可以使用 -f 选项。
rm -f $YOUR_PATH\*-outputs
You can see the different rm options here: rm Linual manual page您可以在此处查看不同的 rm 选项: rm Linual 手册页
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.