how to iterate list and move files in the list to a folder in python code example
Example 1: iterate through all files in directory python
import os
directory = 'the/directory/you/want/to/use'
for filename in os.listdir(directory):
if filename.endswith(".txt"):
#do smth
continue
else:
continue
Example 2: how to get all folders on path in python
os.walk(directory)
[x[0] for x in os.walk(directory)]