ambevar-dotfiles/.scripts/homeclean

79 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
RMLIST="$HOME/.cache/dwb
$HOME/.cache/emacs
$HOME/.cache/mutt
$HOME/.cache/rtorrent
$HOME/.cmus/autosave
$HOME/.cmus/cache
$HOME/.cmus/lib.pl
$HOME/.cmus/playlist.pl
$HOME/.cmus/queue.pl
$HOME/.cmus/resume
$HOME/.cmus/search-history
$HOME/.config/gtk-2.0
$HOME/.config/gtk-3.0
$HOME/.config/ranger/bookmarks
$HOME/.config/ranger/history
$HOME/.config/ranger/tagged
$HOME/.gtk-bookmarks
$HOME/.local/share/newsbeuter
$HOME/.local/share/webkit
$HOME/.mutt.pwds.cpt
$HOME/.ssh
$HOME/.w3m
$HOME/.zcompdump
$HOME/.zdirs
$HOME/.zshhistfile"
echo "==> List of files to be cleaned."
echo "$RMLIST"
CHOICE="N"
echo
echo "==> Clean home? [y/N]"
read CHOICE
CHOICE="$(echo $CHOICE | tr [:lower:] [:upper:])"
if [ "$CHOICE" != "Y" ]; then
echo "Nothing done."
exit
fi
## Delete git repo if any.
if [ -d "$HOME/.git" ]; then
echo
echo "==> Cleaning git repo."
rm -rf "$HOME/.git"
fi
## Delete Dropbox folder if any.
if [ -d "$HOME/Dropbox" ] || [ -d "$HOME/.dropbox" ]; then
echo
echo "==> Cleaning Dropbox folder."
rm -rvf "$HOME/Dropbox"
rm -rvf "$HOME/.dropbox"
fi
## Clean trash if possible.
if [ -z "$(command -v trash-empty)" ]; then
echo
echo "==> Emptying trash."
echo ":: 'trash-empty' not installed, you have to clean trash manually."
rm -rvf "$HOME/.local/share/Trash"
else
echo
echo "==> Emptying trash."
trash-empty
fi
## Clear data.
echo
while read -r i; do
rm -rvf "$i"
done <<EOF
$RMLIST
EOF
echo
echo "==> Cleaning done."