Skip to content

Instantly share code, notes, and snippets.

@tlvince
Created July 9, 2010 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlvince/469452 to your computer and use it in GitHub Desktop.
Save tlvince/469452 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# prowler: delete unwanted files that otherwise pollute $HOME
#
# Author: Tom Vincent
# Created: 2010-07-05
WATCH_FILES="${XDG_CONFIG_HOME:-"$HOME/.config"}/${0##*/}/badfiles" # Bash-ism
LOG="${XDG_CACHE_HOME:-"$HOME/.cache"}/${0##*/}.log"
inotifywait -qm --format '%f' -e create "$HOME" | while read file; do
if $(grep -Fq "$file" "$WATCH_FILES"); then
rm -rf "$HOME/$file"
echo "$(date +"%F %R") :: Deleted $HOME/$file" >> $LOG
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment