import os
import shutil
source_dir = r'C:\\Users\\Andre\\Downloads'
image_dir = r'C:\\Users\\Andre\\Downloads\\images'
file_names = os.listdir(source_dir)
for file_name in file_names:
if '.png' in file_name:
shutil.move(os.path.join(source_dir, file_name), image_dir)
This current code will move all pngs
from source dir to image dir, how can I make it so it also includes pngs
nested in another subdirectory inside the source dir? for example C:\Users\Andre\Downloads\pictures