Advertisement
Falven

anti-macshop.sh

Mar 31st, 2015
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.84 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # Instructions:
  4. # 1. Save this file to anti-macshop.sh (or another name.sh) by clicking download above or copy pasting this text into an empty file.
  5. # 2. Open up the Terminal
  6. # 3. Change directory to where the file is using 'cd directory' (for ex: cd ~/Desktop/)
  7. # 4. type 'chmod +x anti-macshop.sh' in the terminal
  8. # 5. type './anti-macshop.sh'
  9. # 6. Script will delete all references it can find to macshop in common directories. Tested and safe.
  10.  
  11. delete_files () {
  12.     echo "Searching $1 for $2"
  13.     IFS=$'\n'
  14.     found=($(find "$1" -iname "$2" -print))
  15.     echo "Found ${#found[@]} matching files."
  16.     for file in "${found[@]}"
  17.     do
  18.             echo "Deleting: $file"
  19.             mv "$file" ~/.Trash
  20.     done
  21.     echo "Done."
  22. }
  23.  
  24. # Spaces between equals break this
  25. APPS_DIR=/Applications/
  26. SAFARI_EXT_DIR=~/Library/Safari/Extensions/
  27. FIREFOX_EXT_DIR=~/Library/Application\ Support/Firefox/Profiles/
  28. CHROME_EXT_DIR=~/Library/Application\ Support/Google/Chrome/
  29.  
  30. echo ""
  31.  
  32. echo "Finding Applications directory..."
  33. if [ -d "$APPS_DIR" ]; then
  34.     echo "Applications directory found."
  35.     delete_files $APPS_DIR "*macshop*"
  36. else
  37.     echo "Applications directory not found."
  38. fi
  39.  
  40. echo ""
  41.  
  42. echo "Finding Safari extensions directory..."
  43. if [ -d "$SAFARI_EXT_DIR" ]; then
  44.     echo "Safari Extensions found."
  45.     delete_files $SAFARI_EXT_DIR "*macshop*"
  46. else
  47.     echo "Safari extensions directory not found."
  48. fi
  49.  
  50. echo ""
  51.  
  52. echo "Finding Firefox extensions directory..."
  53. if [ -d "$FIREFOX_EXT_DIR" ]; then
  54.     echo "Firefox Extensions found."
  55.     delete_files $FIREFOX_EXT_DIR "*macshop*"
  56. else
  57.     echo "Firefox extensions directory not found."
  58. fi
  59.  
  60. echo ""
  61.  
  62. echo "Finding Chrome extensions directory..."
  63. if [ -d "$CHROME_EXT_DIR" ]; then
  64.     echo "Chrome Extensions found."
  65.     delete_files $CHROME_EXT_DIR "*macshop*"
  66. else
  67.     echo "Chrome extensions directory not found."
  68. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement