Created
December 12, 2011 16:42
-
-
Save aheadley/1468136 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# The minimum age (in days) of tiles to modify | |
MIN_AGE=7 | |
# Number of simultaneous image modifications to run, default is the number of cores | |
MAX_PROCS="$(grep ^processor /proc/cpuinfo | wc -l)" | |
# Percent of saturation to apply to new image, should be an integer from 0-100 | |
DESATURATION=90 | |
if [ -z "$1" ]; then | |
cat <<EOF | |
Usage: $0 path/to/tiles/ path/to/lighting/ <etc..> | |
EOF | |
elif [[ "$1" == "--helper-mode" ]]; then | |
IMAGEFILE="$2" | |
MTIME="$(stat -c %y "${IMAGEFILE}")" | |
mogrify -modulate "100,${DESATURATION}" "${IMAGEFILE}" | |
touch -d "${MTIME}" "${IMAGEFILE}" | |
else | |
find "$@" -mtime "+${MIN_AGE}" -type f -print0 | \ | |
xargs -r -0 -n 1 -P "${MAX_PROCS}" -- "$0" --helper-mode | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated with
-type f