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