DEV Community

Dylan Lopez
Dylan Lopez

Posted on

How to remove all WordPress thumbnails using shell command line

Wordpres site consumes too much storage, here is how we clean up thumbnail. Assuming you're are in current root of wordpress site,

List the files
find . -iname '*-*x*.jpg' | xargs ls

Change x to the thumbnail's size accordingly
example : find . -iname '*-300x300.jpg' | xargs ls

Delete them, WARNING: There is no going back, please backup first!
find . -iname '*-300x300.jpg' | xargs rm -f

Top comments (0)