Skip to content

Commit

Permalink
replace double find commands with smarter set
Browse files Browse the repository at this point in the history
thanks to b. watson
  • Loading branch information
Ryan P.C. McQuen committed Feb 5, 2015
1 parent 7b9ec22 commit 2577370
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions imgult
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,18 @@ fi
## so we can relish in the savings later
du -hs "$@" > preImgultSize

## this is what we call leaning toothpick syndrome
## bsd find needs a path to work, gnu find is smarter ...
if [ -z "$@" ]; then
find . -type f -a \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.jpe' \
-o -iname '*.jfif' -o -iname '*.jif' -o -iname '*.jfi' -o -iname '*.thm' \
-o -iname '*.png' -o -iname '*.apng' -o -iname '*.mng' -o -iname '*.gif' \
-o -iname '*.svg' -o -iname '*.svgz' \) \
> imgult-files.txt
else
find "$@" -type f -a \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.jpe' \
-o -iname '*.jfif' -o -iname '*.jif' -o -iname '*.jfi' -o -iname '*.thm' \
-o -iname '*.png' -o -iname '*.apng' -o -iname '*.mng' -o -iname '*.gif' \
-o -iname '*.svg' -o -iname '*.svgz' \) \
> imgult-files.txt
set .
fi

## this is what we call leaning toothpick syndrome
find "$@" -type f -a \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.jpe' \
-o -iname '*.jfif' -o -iname '*.jif' -o -iname '*.jfi' -o -iname '*.thm' \
-o -iname '*.png' -o -iname '*.apng' -o -iname '*.mng' -o -iname '*.gif' \
-o -iname '*.svg' -o -iname '*.svgz' \) \
> imgult-files.txt

## back it up!
if [ "$BACKUPIMAGES" = true ]; then
rsync -avz --files-from=imgult-files.txt $PWD imgult-backup-files/
Expand Down

0 comments on commit 2577370

Please sign in to comment.