简体   繁体   English

如何从linux中的特定文件夹中删除文件?

[英]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.

相关问题 如何从Linux中的文件夹导入Java文件? - How to import java files from folders in linux? 如何删除 linux 中具有特定模式的文件? - how to delete files have specific pattern in linux? 如何从 Linux 终端使用正则表达式删除文件夹 - How do I delete folders using regex from Linux terminal 在 Linux 中查找特定父文件夹并删除子文件夹中的文件 - Find specific parent folder and delete files inside sub-folders in Linux 如何从 linux 文件中删除特定符号? - How To delete specific symbols from a linux file? 如何递归查找特定文件并从linux中找到的所有文件中删除最后一行? - How to find a specific file recursively and delete the last line from all files found in linux? linux如何允许用户读取/写入/删除从根目录创建的特定文件夹中的文件 - linux how to allow user to read/write/delete files created from root in a specific folder 如何从Linux上的文件夹同步最后修改的文件 - how to sync last modified files from folders on linux 如何在 Linux 中删除早于特定日期的文件? - How do you delete files older than specific date in Linux? 如何在Linux中扫描特定的存储库/文件夹并删除生成的所有其他内容 - How to scan a a specific repos/folders in linux and delete everything else that gets generated
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM