포스트

Linux - 빈 디렉터리 삭제

1
find /path/to/parent_directory -type d -empty -exec rmdir {} \;
  • find 명령어로 조회 된 /path/to/parent_directory 하위의 빈 디렉터리를 rmdir 명령으로 삭제
  • find가 찾은 빈 디렉터리는 {}에 값이 들어감
  • -type d : directory만 검색
  • -empty : 비어있는 것만 검색
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.