Using python I am trying to os.walk a directoy and input file info into an excel file


I have successfully made a os.scandir version of this with single directory output, but I am running into issues when trying to use os.walk, here I am trying to nest the functions, but the output is still single directory. My goal is to get the file info data for all sub directories. Thanks

for root, dirs, files in os.walk(scanpoint):
df1 = pd.DataFrame([])
for dir in dirs:
    with os.scandir(scanpoint) as entries:
        for entry in entries:
            info = entry.stat()
            df = pd.DataFrame({'Name':[],
                            'Last Opened':[datetime.datetime.fromtimestamp(info.st_atime)],
                            'File Extension:':[os.path.splitext([1]],
                            index = [0])
            df1 = df1.append(df)
            writer = ExcelWriter(r'C:UsersAndreyDesktopFolder Info Scan.xlsx')
            df1.to_excel(writer,'Sheet1', index=False) 

Source: Python-3x Questions