Count files in sub directory.

ครับตามชื่อ หัวข้อ ผมต้องการนับว่าใน Current Directory ที่ผมอยู่มีไฟล์ทั้งหมดกี่ไฟล์ และถ้าใน Current Directory มี Subdirectory แล้วก็ใน Subdirectory มีไฟล์ซ่อนอยู่ ก็ให้นับรวมมาด้วย โดยไม่นับรวม Subdirectory นั้นๆ คำสั่งเป็นดังนี้
# find . -type f
./a.txt
./b.txt
./aa/aa.txt
./bb/bb.txt
# find . -type f | wc -l
4

เป็นอันเสร็จพิธี…ที่มาก็มาจากเจ้ Goo นั้นแหละครับผม

Related Posts

This entry was posted in linux and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">