Posted By

priyanhere on 11/20/06


Tagged

Shell unix count linux files directory


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

nimoyjohnson


Count files and directories


 / Published in: Bash
 

URL: http://snipplr.com/users/priyanhere/

  1. F_CNT=0
  2. D_CNT=0
  3. for FILE in *; do
  4. test -f "$FILE" && F_CNT=`expr $F_CNT + 1`
  5. test -d "$FILE" && D_CNT=`expr $D_CNT + 1`
  6. done
  7. echo "$F_CNT files & $D_CNT dirs in current directory."

Report this snippet  

You need to login to post a comment.