Linux rmdir命令:删除空目录

Linux rmdir(英文全拼:remove directory)命令删除空的目录。

语法格式 :  rmdir [参数] [目录名称]

常用参数:

-p用递归的方式删除指定的目录路径中的所有父级目录,非空则报错
-v显示命令的详细执行过程
— — help显示命令的帮助信息
— — version显示命令的版本信息

参考实例

删除空目录:

[root@bunian ~]# rmdir dir

递归删除指定的目录树:

[root@bunian ~]# rmdir -p dir/dir1/dir2

显示指令详细执行过程:

[root@bunian ~]# rmdir -v dir
rmdir: removing directory, 'dir'
[root@bunian ~]# rmdir -p -v dir/dir1/dir2
rmdir: removing directory, ‘dir/dir1/dir2’
rmdir: removing directory, ‘dir/dir1’
rmdir: removing directory, ‘dir’

显示命令的版本信息:

[root@bunian ~]# rmdir --version
rmdir (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
© 版权声明
THE END