python folder file count 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))])