• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# rmdir
2
3
4## Command Function<a name="section1839611420266"></a>
5
6This command is used to delete a directory.
7
8## Syntax<a name="section329574512266"></a>
9
10rmdir \[_-p_\] \[_dirname..._\]
11
12## Parameters<a name="section15865747102620"></a>
13
14**Table  1**  Parameter description
15
16<a name="table1557mcpsimp"></a>
17<table><thead align="left"><tr id="row1563mcpsimp"><th class="cellrowborder" valign="top" width="21%" id="mcps1.2.4.1.1"><p id="p1565mcpsimp"><a name="p1565mcpsimp"></a><a name="p1565mcpsimp"></a><strong id="b170710424141"><a name="b170710424141"></a><a name="b170710424141"></a>Parameter</strong></p>
18</th>
19<th class="cellrowborder" valign="top" width="52%" id="mcps1.2.4.1.2"><p id="p1567mcpsimp"><a name="p1567mcpsimp"></a><a name="p1567mcpsimp"></a><strong id="b10358846121415"><a name="b10358846121415"></a><a name="b10358846121415"></a>Description</strong></p>
20</th>
21<th class="cellrowborder" valign="top" width="27%" id="mcps1.2.4.1.3"><p id="p1569mcpsimp"><a name="p1569mcpsimp"></a><a name="p1569mcpsimp"></a><strong id="b171032047111410"><a name="b171032047111410"></a><a name="b171032047111410"></a>Value Range</strong></p>
22</th>
23</tr>
24</thead>
25<tbody><tr id="row17771161013316"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p19752111019336"><a name="p19752111019336"></a><a name="p19752111019336"></a>--help</p>
26</td>
27<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p18752121015338"><a name="p18752121015338"></a><a name="p18752121015338"></a>Displays the parameters supported by the <strong id="b101038101521"><a name="b101038101521"></a><a name="b101038101521"></a>rmdir</strong> command.</p>
28</td>
29<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p127521810103316"><a name="p127521810103316"></a><a name="p127521810103316"></a>N/A</p>
30</td>
31</tr>
32<tr id="row977061043317"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p67521810113316"><a name="p67521810113316"></a><a name="p67521810113316"></a>-p</p>
33</td>
34<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p1475271013319"><a name="p1475271013319"></a><a name="p1475271013319"></a>Deletes a path.</p>
35</td>
36<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p117525107338"><a name="p117525107338"></a><a name="p117525107338"></a>N/A</p>
37</td>
38</tr>
39<tr id="row2769810133315"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p775211053314"><a name="p775211053314"></a><a name="p775211053314"></a>--ignore-fail-on-non-empty</p>
40</td>
41<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p77522010123314"><a name="p77522010123314"></a><a name="p77522010123314"></a>Suppresses the error message when a non-empty directory is to be deleted.</p>
42</td>
43<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p1475281014339"><a name="p1475281014339"></a><a name="p1475281014339"></a>N/A</p>
44</td>
45</tr>
46<tr id="row1776918105337"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p5752141018337"><a name="p5752141018337"></a><a name="p5752141018337"></a>dir</p>
47</td>
48<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3752161083313"><a name="p3752161083313"></a><a name="p3752161083313"></a>Specifies the name of the directory to delete. The directory must be empty. A path is supported.</p>
49</td>
50<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p57521210113313"><a name="p57521210113313"></a><a name="p57521210113313"></a>N/A</p>
51</td>
52</tr>
53</tbody>
54</table>
55
56## Usage<a name="section107857508261"></a>
57
58-   The  **rmdir**  command can only be used to delete directories.
59-   The  **rmdir**  command can delete only one directory at a time.
60-   The  **rmdir**  command can delete only empty directories.
61
62## Example<a name="section11196165315262"></a>
63
64Run  **rmdir dir**.
65
66## Output<a name="section1073811415613"></a>
67
68Deleting the directory  **dir**:
69
70```
71OHOS:/test$ mkdir dir
72OHOS:/test$ ls
73dir
74OHOS:/test$ rmdir dir/
75OHOS:/test$ ls
76```
77
78