本文学习一下linux中命令: rmdir命令。rmdir是常用的命令,该命令的功能是删除空目录,一个目录被删除之前必须是空的。(注意,rm - r dir命令可代替rmdir,但是有很大危险性。)删除某目录时也必须具有对父目录的写权限。
1.命令格式:
2.命令功能:
3.命令参数:
[root@localhost scf]# tree . |-- bin |-- doc | |-- info | `-- product |-- lib |-- logs | |-- info | `-- product `-- service `-- deploy |-- info `-- product 12 directories, 0 files [root@localhost scf]# rmdir doc rmdir: doc: 目录非空 [root@localhost scf]# rmdir doc/info [root@localhost scf]# rmdir doc/product [root@localhost scf]# tree . |-- bin |-- doc |-- lib |-- logs | |-- info | `-- product `-- service `-- deploy |-- info `-- product 10 directories, 0 files
说明:
实例2:rmdir -p 当子目录被删除后使它也成为空目录的话,则顺便一并删除
[root@localhost scf]# tree . |-- bin |-- doc |-- lib |-- logs | `-- product `-- service `-- deploy |-- info `-- product 10 directories, 0 files [root@localhost scf]# rmdir -p logs rmdir: logs: 目录非空 [root@localhost scf]# tree . |-- bin |-- doc |-- lib |-- logs | `-- product `-- service `-- deploy |-- info `-- product 9 directories, 0 files [root@localhost scf]# rmdir -p logs/product [root@localhost scf]# tree . |-- bin |-- doc |-- lib `-- service `-- deploy |-- info `-- product 7 directories, 0 files
总结: (责任编辑:IT) |