Guest User

Untitled

a guest
Apr 20th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.52 KB | None | 0 0
  1. for i in *
  2. do
  3.   if [ ! -f "$i" ] && [ -d "$i" ]
  4.     echo "Element is a directory"
  5.     then
  6.       FILES=`ls -l "$i" | wc -l` # List the content of "$i" directory
  7.                                   # and count the number of lines
  8.       FILES2=`expr $FILES - 1`   # Substract one because one line is
  9.                                   # occupied with the number of blocks
  10.       echo "$i: $FILES2"         # Shows the name of the directory and
  11.                                   # the number of inputs that it has
  12.   fi
  13. done
Advertisement
Add Comment
Please, Sign In to add comment