Home > BashScripts > check how many files in a directory

check how many files in a directory

Script to count how many files exists in directory and subdirectories
based on Gerd Stammwitz original script.

It is helpfull in some cases, just to find out how many files you have recursive in a directory

  1. Markus Mann
    February 19th, 2014 at 16:50 | #1

    In the case statement processing the cmd-line switches you can use

    -h|–help) …

    so you don’t need to have the same code two times.

    -perfdata should be -p|–perfdata i suppose

    Line 172 doesn’t make any sense?

  2. prakash
    April 3rd, 2016 at 09:03 | #2

    got errors:

    ./check_files_sh: line 68:     print_usage: command not found
    ./check_files_sh: line 69:     exit: command not found
    ./check_files_sh: line 80: syntax error near unexpected token `)’
    ./check_files_sh: line 80: `        –help)’

    • admin
      April 25th, 2016 at 17:08 | #3

      Prakash,
      I just tried here and it worked.
      What OS are you running?
      It is tested on Linux Centos/RedHat/Debian/Ubuntu only.
      thx

  1. No trackbacks yet.

VAMOVE *

*