Last active
December 19, 2017 15:52
-
-
Save hisnameisjimmy/5ff1afff30c1fe2285eba6e5b59e3d79 to your computer and use it in GitHub Desktop.
Find all duplicate images from Wordpress
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
To see the list before deleting: | |
find -E . -regex '.*\-[0-9]{1,4}\x[0-9]{1,4}\.(png|gif|jpg)$' > ./duplicates.txt | |
To delete: | |
find -E . -regex '.*\-[0-9]{1,4}\x[0-9]{1,4}\.(png|gif|jpg)$' -delete | |
Run a find/replace on your mysqldump backup (and create a backup of that) to remove references to alternate wordpress files: | |
sed -i .bak -E 's#\-[0-9]{1,4}\x[0-9]{1,4}##g' backup.sql | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment