리눅스 / 명령어 / rmdir - 빈 디렉토리 삭제하는 명령어
rmdir
rmdir은 빈 디렉토리를 삭제하는 명령어입니다.
Remove the DIRECTORY(ies), if they are empty.
사용법
rmdir directory
rmdir a
a 디렉토리를 삭제합니다. 비어있다면 삭제를 하고, 그렇지 않다면
rmdir: failed to remove ‘a’: Directory not empty
를 출력합니다.
rmdir --ignore-fail-on-non-empty directory
디렉토리가 비어있지 않아도 메시지를 출력하지 않습니다.
rmdir -v directory
rmdir -v *
현재 디렉토리 안에 있는 모든 비어있는 디렉토리를 삭제합니다. v 옵션을 넣으면 작업 결과를 출력합니다. 예를 들어 헌재 디렉토리에 a, b, c 디렉토리가 있고, a와 c는 빈 디렉토리, b는 비어있지 않은 디렉토리라면, 다음을 출력합니다.
rmdir: removing directory, ‘a’ rmdir: removing directory, ‘b’ rmdir: failed to remove ‘b’: Directory not empty rmdir: removing directory, ‘c’
rmdir -p directory
rmdir -p a/b/c
a/b/c를 삭제하고, a/b를 삭제하고, a를 삭제합니다.
rmdir a/b/c a/b a
와 같습니다.
rmdir --help
rmdir --help
도움말을 출력합니다.