1. Function: Delete empty directory.
2. Usage:rmdir parameter Path
3. Parameters:
-P: Recursively delete empty directories, ' rmdir-p a/b/c ' is equivalent to executing a rmdir a/b/c A/b '
4. Example
[Email protected] home]# tree test
Test
├──test_1
│├──test_1.txt
│└──test_2
│├──test_2.txt
│└──test_3
├──test_1.txt
└──test_4
└──test_5
Example 1:test_1 file, can not be deleted through the rmdir command, Test_5, there is no file under the rmdir command to delete;
[Email protected] home]# rmdir test/test_4/test_5/
[Email protected] home]# rmdir test/test_1
RmDir: Delete "test/test_1" failed: Directory not empty
[Email protected] home]# tree test
Test
├──test_1
│├──test_1.txt
│└──test_2
│├──test_2.txt
│└──test_3
├──test_1.txt
└──test_4
Example 2: Delete Test_4, Test_5, test_6 three folders at the same time
[Email protected] test]# mkdir-p test/test_4/test_5/test_6
[Email protected] test]# tree
.
├──test
│└──test_4
│└──test_5
│└──test_6
├──test_1
│├──test_1.txt
│└──test_2
│├──test_2.txt
│└──test_3
└──test_1.txt
[Email protected] test]# rmdir-p test/test_4/test_5/test_6/
[Email protected] test]# tree
.
├──test_1
│├──test_1.txt
│└──test_2
│├──test_2.txt
│└──test_3
└──test_1.txt
A few empty folders under the test folder have been deleted.
This article is from the "three countries Cold jokes" blog, please be sure to keep this source http://hwj91.blog.51cto.com/9763975/1773141
Linux Common Commands Summary--rmdir