在Unix中,你如何在当前目录和它下面的一切删除? [英] In Unix, how do you remove everything in the current directory and below it?

查看:153
本文介绍了在Unix中,你如何在当前目录和它下面的一切删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这将是在一个子目录删除一切和它下面:

I know this will delete everything in a subdirectory and below it:

rm -rf <subdir-name>

但你如何删除当前目录下的一切,以及它下面的每个子目录和所有子目录的内容?

But how do you delete everything in the current directory as well as every subdirectory below it and the contents of all of those subdirectories?

推荐答案

实践安全计算。只需转到上一级的层次结构,而不使用通配符前pression:

Practice safe computing. Simply go up one level in the hierarchy and don't use a wildcard expression:

cd ..; rm -rf -- <dir-to-remove>

这两个破折号 - 告诉 RM &LT; D​​IR-拆卸的&GT ; 不是一个命令行选项,甚至当它开始以短线

The two dashes -- tell rm that <dir-to-remove> is not a command-line option, even when it begins with a dash.

这篇关于在Unix中,你如何在当前目录和它下面的一切删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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