Created
November 19, 2015 17:16
-
-
Save jessepearson/dc77c1b57a40f9bb6648 to your computer and use it in GitHub Desktop.
Remove redundant, additional image sizes in wordpress via command line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Taken from: http://www.deluxeblogtips.com/2012/05/remove-image-sizes.html | |
| If you want to remove files of specific size (for ex. 180x180), run this command: | |
| find . -name *-180x180.* | xargs rm -f | |
| This will remove all files with name *-180x180.* (such as screenshot-180x180.jpg), which are generated by WordPress. | |
| Note: You can only do this if you have privilege of running Linux command on your host/server. If you don’t (in case of using shared host), you should ask your host support to do this for you. | |
| If you want to remove all generated files, run this command: | |
| Warning: It will remove all files with name *-*x*.* (image1-80x80.png, image2-120x100.jpg). If this pattern matches one of your original file names, then you’ll loose it. So be careful and make sure you know what you’re doing! | |
| find . -name *-*x*.* | xargs rm -f | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment