I pieced together a shell script to display (and optionally obliterate) Flash's cookie stash. Simply run with no args to view the crumbs. Any arg except -h (or anything with an H or h in it) will erase said items.
cfc (Clear Flash Cookies)
#!/bin/bash -u -
# cfc ::: Clear Flash Cookies
#(c)EF/-HI-2010.Sep.23 [rev:2010.Sep.25]
IFS=$' \t\n'
declare -x PATH=/bin:/usr/bin
declare -i x=0 c=0 k=0
subf= args= list=
PRG=`basename "$0"`
DR1=~/Library/Preferences/Macromedia/Flash?Player
DR2=~/Library/Caches/Adobe/Flash?Player
trap tabs EXIT
Help () {
printf '\e[4mClear Flash Cookies\e[0m\nUsage:\n'
printf '\t\e[1m%s\e[0m [\e[1m-?\e[0m]\n\n' $PRG
printf 'Run with no args to list the cookies.\n'
printf 'Any arg except -h clears the cookies.\n'
exit 1
}
[ $# -ne 0 ] && [[ $1 = *[Hh]* ]] && Help
Tree () { # print a tree of the cwd:
local dir= par= ind= fix=
dir=`pwd -P`; par=`dirname "$dir"`; tabs -5; ind=$'\t'
[[ $par = / ]] && fix=$ind
find -x "$dir" -print0 |xargs -0 ls -1dfF |sed 's:'"$par"':'"$fix"':;
s:/$: \\:;s:[^/]*/:'"$ind"':g;s: \\$:/:;s:'"$ind"':'"$fix"':;
1s:'"$fix"'::' |sed "s:[/*@=|%]$:`printf '\e[1m&\e[0m'`:"
tabs
}
GoToFolder () {
2>/dev/null cd "$1" >&2 && return 0 || {
printf 'cannot access folder: %s/\n\a' "$1"
return 1
}
}
ScanFolder () {
GoToFolder "$1" || return 1
c=`ls -p1 |grep -e '/$' |wc -l |sed 's:[^0-9]::g'`
subf=`ls -p1 |grep -e '/$' |sed 's:/$::;s: :\?:g'`
case $c in
0) printf 'no subfolders exist in: %s\n' "$1"; return 1;;
1) args=$subf;;
*) args=-f\ $subf;;
esac
list=`find -x $args -not -type d`
if [[ -n $list ]]
then
[ $k -eq 0 ] && printf '\n\e[7mFILES FOUND:\e[0m'
printf '\n\e[1;4m%s\e[0;1m/\e[0m\n' "$1"
echo "$list" |tr '\n' '\000' |xargs -0 ls -legthrob
echo
((k+=1))
fi
return 0
}
for d in $DR1 $DR2; do ScanFolder "$d"; done
[ $k -eq 0 ] && printf 'already cleared...\n'
printf '\n\e[7mTREE LISTING:\e[0m\n'
printf '\e[1;4mPREFS\e[0m\n'
GoToFolder $DR1 && Tree
printf '\n\e[1;4mCACHE\e[0m\n'
GoToFolder $DR2 && Tree
echo
if [ $# -ne 0 ] && [ $k -ne 0 ]
then # remove cookie & cache items, but leave "basic" directory trees intact:
GoToFolder $DR1 &&
rm -fR {macromedia.com/support/flashplayer/sys,#SharedObjects/*}/*
x=$?
GoToFolder $DR2 && rm -fR AssetCache/*/*
((x+=$?))
[ $x -eq 0 ] && printf '\e[30;42m FLASH COOKIES CLEARED \e[0m\n' ||
printf '\e[37;41m %s: an error occurred \e[0m\n' $PRG
fi
exit $x
Before anyone points out that there are
much simpler ways to "do" this, please note the (only) two comments in the code, and consider that i was bending over backwards to preserve the original (base) folder structure... though i don't remember why (perhaps just as a coding exercise).
-HI-
EDIT: the
-h option just brings up some help text...
$ cfc -h
Clear Flash Cookies
Usage:
cfc [-?]
Run with no args to list the cookies.
Any arg except -h clears the cookies.