Skip to navigation
Delete wordpress thumb files but skip registered files
18.08.26
## find registered WordPress files wp post list --post_type=attachment --fields=guid --format=csv --skip-plugins --allow-root | tail -n +2 | sed 's|https\?://[^/]*/wp-content/uploads/||' | sort > /tmp/wp_registered.txt ## delete all thumb but keep registerd for sure ``` find /var/customers/webs/shop/wp-shop/www/wp-content/uploads -type f -regextype posix-extended -regex '.*-[0-9]+x[0-9]+\.(jpg|jpeg|png|gif|webp)$' | grep -vxFf /tmp/wp_registered.txt | xargs -d '\n' rm -f ```
Reply
Anonymous
Information Epoch 1787652641
You can always add complexity.
Home
Notebook
Contact us