Last active
August 29, 2015 14:20
-
-
Save simonwheatley/7fc21050478fb3a4d1a9 to your computer and use it in GitHub Desktop.
Remove all files called example.html and containing the string "<title>Genericons</title>". Usage: `./remove-genericons-example-html.sh /path/to/site/`
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
#!/bin/bash | |
# | |
# Remove all files called example.html and | |
# containing the string | |
# "<title>Genericons</title> | |
# | |
# Copyright Automattic Inc, 2015 | |
# | |
# This script is free software, and is released under the | |
# terms of the GPL version 2 or (at your option) any | |
# later version. | |
# | |
# See | |
# --- | |
# | |
# https://cftp.zendesk.com/agent/tickets/187 | |
# | |
# Usage | |
# ----- | |
# | |
# # Process updates for all admin users in all instances | |
# ./remove-genericons-example-html.sh /var/www/html/ | |
# | |
PATH_TO_INSTALLS=$1 | |
RED='\e[0;31m' | |
GREEN='\e[0;32m' | |
NC='\e[0m' # No Color | |
# VALIDATIONS | |
if [ -z "$PATH_TO_INSTALLS" ]; then | |
echo -e "${RED}Please provide a path to the installs, e.g. './remove-genericons-example-html.sh /var/www/html/'.${NC}" | |
exit 1 | |
fi | |
if [ ! -d "$PATH_TO_INSTALLS" ]; then | |
echo -e "${RED}The directory ${PATH_TO_INSTALLS} does not exist.${NC}" | |
exit 20 | |
fi | |
find "$PATH_TO_INSTALLS" -name example.html -print0 | xargs -0 grep -lIZ "<title>Genericons</title>" | xargs -0 rm -fv -- | |
echo -e "${GREEN}Recursively removed all example.html files containing '<title>Genericons</title>', starting at ${PATH_TO_INSTALLS}. See output above for details.${NC}" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment