count_elements.py 673 B

123456789101112131415161718192021222324252627282930
  1. # main import
  2. import os
  3. import argparse
  4. def count_folder_elements(folder):
  5. folders = os.listdir(folder)
  6. for folder_name in folders:
  7. folder_path = os.path.join(folder, folder_name)
  8. images = sorted(os.listdir(folder_path))
  9. print('Folder %s has %s elements' % (folder_name, len(images)))
  10. def main():
  11. parser = argparse.ArgumentParser(description="extract and create 7 parts of image from HD one")
  12. parser.add_argument('--folder', type=str, help="folder with HD images", required=True)
  13. args = parser.parse_args()
  14. p_folder = args.folder
  15. count_folder_elements(p_folder)
  16. if __name__ == "__main__":
  17. main()