Created
May 10, 2015 09:12
-
-
Save cdukes/d33714db6e66a4e1de97 to your computer and use it in GitHub Desktop.
Remove WP-style generated images, leaving only the originals.
This file contains 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
# OS X | |
# List affected files | |
find -E . -regex '.*/[-_a-zA-Z0-9]+-[0-9]+x[0-9]+\..+' -print -exec ls '{}' \; | |
# Remove affected files | |
find -E . -regex '.*/[-_a-zA-Z0-9]+-[0-9]+x[0-9]+\..+' -print -exec rm '{}' \; | |
# Downsize all images to 1200px | |
find . -iname "*.jpg" -type f -exec sh -c 'sips -Z 1200 "$0"' {} \; | |
# Linux | |
# OS X | |
# List affected files | |
find . -regex '.*/[-_a-zA-Z0-9]+-[0-9]+x[0-9]+\..+' -print -exec ls '{}' \; | |
# Remove affected files | |
find . -regex '.*/[-_a-zA-Z0-9]+-[0-9]+x[0-9]+\..+' -print -exec rm '{}' \; | |
# Downsize all images to 1200px | |
find . -iname "*.jpg" -type f -exec sh -c 'convert "$0" -resize 1200x1200\> "$0"' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment