Skip to content Skip to sidebar Skip to footer

Python - How To Recursively Add A Folder's Content In A Dict

I am building a python script which will be removing duplicates from my library as an exercise in python. The idea is to build a dict containing a dict ( with the data and statist

Solution 1:

Use os.walk.

import os
for dirpath,dirs,files in os.walk(ROOT):
    for f in dirs + files:
        fn = os.path.join(dirpath, f)
        FILES[fn] = Analyse(fn)

Post a Comment for "Python - How To Recursively Add A Folder's Content In A Dict"