Advertisement
TurkevichV

Untitled

May 13th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. def rel_dictionary():  # collect all names of release folders
  2.     path = r"D:\Users\Public\Downloads\01ProjectEmptyFiles".upper()
  3.     rel_dict = set()
  4.     files_dict = set()
  5.     for year in os.listdir(path):
  6.         if os.path.isdir(os.path.join(path, year)):
  7.             for job in os.listdir(os.path.join(path, year)):
  8.                 if os.path.isdir(os.path.join(path, year, job)):
  9.                     for folder in os.listdir(os.path.join(path, year, job)):
  10.                         if os.path.isdir(os.path.join(path, year, job, folder)) and folder in ['ID', 'IDs', 'PD', 'PDs']:
  11.                             for rel in os.listdir(os.path.join(path, year, job, folder)):
  12.                                 if rel.count('.'):
  13.                                     files_dict.add(rel.upper())
  14.                                 else:
  15.                                     rel_dict.add(rel.upper())
  16.     for i in rel_dict:
  17.         print(i)
  18.     for i in files_dict:
  19.         print(i)
  20.     print(len(rel_dict), len(files_dict))
  21.  
  22.  
  23. rel_dictionary()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement