I have the following code:
path = "/path/to/directory/"
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
file = os.path.join(dirpath, filename)
folder = os.path.basename(dirpath)
filesize = os.path.getsize(file)
The only problem is that I would like to filter and get the information only for the mp4 files, excluding the others from the search.
I tried to add *.mp4 at the end of path
without success, how I can do that?