Deleting directories using single liner command

爱⌒轻易说出口 提交于 2019-12-05 22:14:59

rm -r edi edw

rm can take an arbitrary number of arguments, and the -r flag makes it delete directories recursively. Refer to man rm for more details. And, BTW, read it, it would have avoided this question altogether.

rmdir edi edw

if the directories are both empty, otherwise

rm -r edi edw

or

rm -r ed[iw]

Specifically for your case:

rmdir -r ed[iw]

It basically removes any directory with the name of ed followed by either i or w

TonySu
rm -r ed*

-r means delete directories. ed* make match edi and edw. if there is another directory name start with ed,please be careful!

rmdir ed* if they are empty (shell will expand ed* to match edi and edw, * is a wildcard character meaning "any string of characters").

rm -r ed* if they are not empty.

Neither of these commands will move your dirs to the trash bin so when using them always make sure that you don't need the dirs or their content.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!