Count files and directories


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  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."

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.