如何通过终端(bash shell)快速删除文件和目录 [英] How to remove files and directories quickly via terminal (bash shell)

查看:270
本文介绍了如何通过终端(bash shell)快速删除文件和目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从终端窗口:

当我使用 rm 命令时,它只能删除文件。

当我使用 rmdir 命令时,它只会删除空文件夹。

When I use the rm command it can only remove files.
When I use the rmdir command it only removes empty folders.

如果我的目录中嵌套了文件和文件夹,且文件夹中包含文件等等,是否有任何方法可以删除所有文件和文件夹而无需键入所有繁琐的命令?

If I have a directory nested with files and folders within folders with files and so on, is there any way to delete all the files and folders without all the strenuous command typing?

如果有所作为,我使用的是来自终端的mac bash shell,而不是Microsoft DOS或linux。

If it makes a difference, I am using the mac bash shell from terminal, not Microsoft DOS or linux.

推荐答案

rm -rf some_dir

-r递归
-f强制(禁止确认消息)

-r "recursive" -f "force" (suppress confirmation messages)

请注意!

这篇关于如何通过终端(bash shell)快速删除文件和目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆