linux系列(六):rmdir命令
生活随笔
收集整理的這篇文章主要介紹了
linux系列(六):rmdir命令
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1、命令格式:
rmdir?[選項(xiàng)] 目錄名
2、命令功能:
該命令從一個(gè)目錄中刪除一個(gè)或多個(gè)子目錄項(xiàng),刪除某目錄時(shí)也必須具有對(duì)父目錄的寫權(quán)限。
3、命令參數(shù):
- p 刪除指定目錄后,若該目錄的上層目錄已變成空目錄,則將其一并刪除;-v, --verbose 顯示指令執(zhí)行過(guò)程4、常用實(shí)例:
(1)、rmdir不能刪除非空目錄。
命令:
rmdir test1
輸出:
felix@felix-computer:~/test$ tree . ├── test1 │?? ├── hello.txt │?? └── test2 └── test33 directories, 1 file felix@felix-computer:~/test$ rmdir test1 rmdir: 刪除 'test1' 失敗: 目錄非空 felix@felix-computer:~/test$ rmdir test3felix@felix-computer:~/test$ tree
.
└── test1
??? ├── hello.txt
??? └── test2
2 directories, 1 file
felix@felix-computer:~/test$
說(shuō)明:
rmdir 目錄名? 該命令不能直接刪除非空目錄
(2)、rmdir?-p?當(dāng)子目錄被刪除后使它也成為空目錄的話,則順便一并刪除
命令:
rmdir -p test3/test/test4/test5
輸出:
felix@felix-computer:~/test$ tree . ├── test1 │?? ├── hello.txt │?? ├── test2 │?? └── test4 └── test3└── test└── test4└── test57 directories, 1 file felix@felix-computer:~/test$ rmdir -p test3/test/test4/test5 felix@felix-computer:~/test$ tree . └── test1├── hello.txt├── test2└── test43 directories, 1 file felix@felix-computer:~/test$?
轉(zhuǎn)載于:https://www.cnblogs.com/felixwang2/p/9907234.html
總結(jié)
以上是生活随笔為你收集整理的linux系列(六):rmdir命令的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 彻底的卸载SQL Server2005
- 下一篇: 解释一下python中的//,%和**运