[Solved] How can i delete multiple images from multiple folders using python [closed]


import os
import random

for folder in folder_paths:  # Go over each folder path
    files = os.listdir(folder)  # Get filenames in current folder
    files = random.sample(files, 900)  # Pick 900 random files
    for file in files:  # Go over each file name to be deleted
        f = os.path.join(folder, file)  # Create valid path to file
        os.remove(f)  # Remove the file

2

solved How can i delete multiple images from multiple folders using python [closed]