how to see the number of files in a directory in pythjon code example
Example 1: python count files directory
import os
len(os.listdir(directory))
Example 2: python monitor directory for files count
import os.path
path = os.getenv('HOME') + '/python'
num_files = len([f for f in os.listdir(path)if os.path.isfile(os.path.join(path, f))])