zoukankan      html  css  js  c++  java
  • linux系列(六):rmdir命令

    1、命令格式:

      rmdir [选项] 目录名

    2、命令功能:

      该命令从一个目录中删除一个或多个子目录项,删除某目录时也必须具有对父目录的写权限。

    3、命令参数:

    - p 删除指定目录后,若该目录的上层目录已变成空目录,则将其一并删除;
    
    -v, --verbose  显示指令执行过程 

    4、常用实例:

    (1)、rmdir不能删除非空目录。

    命令:

      rmdir test1

    输出:

    felix@felix-computer:~/test$ tree
    .
    ├── test1
    │   ├── hello.txt
    │   └── test2
    └── test3
    
    3 directories, 1 file
    felix@felix-computer:~/test$ rmdir test1
    rmdir: 删除 'test1' 失败: 目录非空
    felix@felix-computer:~/test$ rmdir test3
    felix@felix-computer:~/test$ tree
    .
    └── test1
        ├── hello.txt
        └── test2

    2 directories, 1 file
    felix@felix-computer:~/test$

    说明:

    rmdir 目录名  该命令不能直接删除非空目录

    (2)、rmdir -p 当子目录被删除后使它也成为空目录的话,则顺便一并删除

    命令:

      rmdir -p test3/test/test4/test5

    输出:

    felix@felix-computer:~/test$ tree
    .
    ├── test1
    │   ├── hello.txt
    │   ├── test2
    │   └── test4
    └── test3
        └── test
            └── test4
                └── test5
    
    7 directories, 1 file
    felix@felix-computer:~/test$ rmdir -p test3/test/test4/test5
    felix@felix-computer:~/test$ tree
    .
    └── test1
        ├── hello.txt
        ├── test2
        └── test4
    
    3 directories, 1 file
    felix@felix-computer:~/test$ 
  • 相关阅读:
    用node探究http缓存
    静态资源增量更新,转自美团
    前端调试相关
    写完此篇,开始新的征程!
    SSM整合
    SpringMVC
    Mybatis
    设计模式之代理模式
    设计模式之工厂模式
    设计模式之单例模式最佳实现方式
  • 原文地址:https://www.cnblogs.com/felixwang2/p/9907234.html
Copyright © 2011-2022 走看看