I would like to loop through the given directory e://www/files/delivery and all its subdirectories and delete all images that end with _thumb.jpg.
What i have tried so far:
import os
dir='e:\www\files\delivery'
for root, dirs, files in os.walk(dir):
for name in files:
if name.endswith(("_thumb.jpg")):
os.remove(name?)....
Apparently this does not work.
Also, if i alternatively want to resize all images using python wand library instead of deleting them, would it be the same process?
import os
dir='e:\www\files\delivery'
for root, dirs, files in os.walk(dir):
for name in files:
if name.endswith(("_thumb.jpg")):
os.remove(os.path.join(root, name))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With