code: def countfiles(path, recurse=False):
      
      if not op.isdir(path):
          return 0
      count = 0
      for r,ds,fs in os.walk(path):
          count += len(fs)
          if not recurse:
              break
      return count
docs: Returns the number of files under the given directory path.