The number of files.

Discussion in 'Programming/Scripts' started by KenzoIT, Oct 20, 2010.

  1. KenzoIT

    KenzoIT New Member

    Hi all,

    My folder have some files and I want to show the number of files on folder at "There are : " line.

    This is my code :

    #!/bin/sh

    if [ -d /home/kenzo/Monday/ ] && {
    echo "Monday"
    ls -l /home/kenzo/Monday/
    };then
    echo "===================================================="
    echo "There are : "

    else
    echo -e "Folder of Monday not find."
    echo "===================================================="
    fi
    exit 0

    The script work well but it doesn't show the number of files at "There are : " line.

    Is it possible, pls intruct me how to do it.
    Thanks !
     
  2. BorderAmigos

    BorderAmigos New Member

    echo "There are : "
    ls -1 /home/kenzo/Monday/
    else


    ^^^ Add the line in the middle.
     
  3. KenzoIT

    KenzoIT New Member

    Monday folder have four files.
    I tested as your instruction but it doesn't show files at the line.
    (There are : 4 files on folder. )

    Anyone help me how to fix it ?
    Thanks all !
     

Share This Page