Created
March 6, 2012 17:23
-
-
Save shakesoda/1987597 to your computer and use it in GitHub Desktop.
Quick and dirty shell script to remove some junk files from JOE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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