python
#Import required modules
import sys
import os
import tkinter,tkinter.filedialog
#Import to display files in a row
import pprint
#Creating a file dialog
root=tkinter.Tk()
root.withdraw()#Description because processing may stop when the main window of Tkinter starts
msg='Please select a folder'
my_path=tkinter.filedialog.askdirectory(title=msg)
if (not my_path):
print('User canceled')
sys.exit()
#OS.Use the walk function to scan and display the files in the folder
for dirpaht,dirs,files in os.walk(my_path):
for fname in files:
pprint.pprint(fname)
Recommended Posts