Skip to content

Instantly share code, notes, and snippets.

@shakesoda
Created March 6, 2012 17:23
Show Gist options
  • Save shakesoda/1987597 to your computer and use it in GitHub Desktop.
Save shakesoda/1987597 to your computer and use it in GitHub Desktop.
Quick and dirty shell script to remove some junk files from JOE
#!/usr/bin/env bash
if [[ $# != "1" ]]; then
echo "Not enough arguments. Usage: jcl <path>"
exit
fi
# remove trailing slash
path=`echo $1 | sed 's/\/*$//'`
ops=0
if [[ ! -d $path ]]; then
echo "$path not found."
exit
fi
if [[ -f $path/DEADJOE ]]; then
ops=1
echo "Removing DEADJOE..."
rm $path/DEADJOE
fi
for file in $path/*~; do
if [[ $file == "$path/*~" ]]; then
continue
fi
rm $file
ops=1
echo "Removed $file"
done
if [[ $ops != "0" ]]; then
echo "Removed joe backup files from $path."
else
echo "Nothing to do."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment