rmdir [ -p ] Directory ...
The rmdir command removes the directory, specified by the Directory parameter, from the system. The directory must be empty before you can remove it, and you must have write permission in its parent directory. Use the ls -al command to check whether the directory is empty.
Note: The rmdir command supports the -- (dash, dash) parameter as a delimiter that indicates the end of the flags.
This command returns the
following exit values:
0 | Each directory entry specified by a Directory parameter was removed successfully. |
>0 | An error occurred. |
rm mydir/* mydir/.* rmdir mydir
This command removes the contents of the mydir file and then removes the empty directory. The rm command displays an error message about trying to remove the directories . (dot) and .. (dot, dot), and then the rmdir command removes them.
Note that the rm mydir/* mydir/.* command first removes files with names that do not begin with a dot, and then removes those with names that do begin with a dot. You may not realize that the directory contains file names that begin with a dot because the ls command does not normally list them unless you use the -a flag.
rmdir -p /home/demo/mydir
This command removes first the /mydir directory and then the /demo and /home directories, respectively. If a directory is not empty or does not have write permission when it is to be removed, the command terminates.
/usr/bin/rmdir | Contains the rmdir command. |
Files Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
Directory Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
File and Directory Access Modes in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
The ls command, mkdir command, rm command.
The rmdir subroutine, unlink subroutine.