지식정보
유닉스에서 특정 디렉토리내에 파일 갯수 세기
onggun
2012. 11. 2. 11:08
유닉스 명령어: 디렉토리내 파일 갯수 알아보기
=====================================================================
ls | wc -l
현재 디렉토리의 파일갯수 세기
ls -d */ | wc -l
현재 디렉토리의 하위 디렉토리 세기
find . | wc -l
현재 디렉토리로 부터 하위 디렉토리 까지 전부 세기
find . -type d | wc -l
find . -type d -maxdepth 1 | wc -l
현재 디렉토리내의 하위 디렉토리 갯수만 세기
find . -type d -maxdepth 1 -path './*' | wc -l
find . -type d -maxdepth 1 -name "*" | wc -l
주- [man find]
-type c
File is of type c:
b block (buffered) special
c character (unbuffered) special
d directory
p named pipe (FIFO)
f regular file
l symbolic link
s socket
D door (Solaris)