My timestamping/thumbnailing script

| -Uncategorized
#!/bin/bash
while [ -n "$1" ]; do
  if [ -f $1 ]; then
    DATE=$(date +"%Y%m%d-%H%M%S" --reference="$1")
    EXT=$(echo "$1" | sed 's/.*\././')
    DEST="$DATE$EXT"
    echo $1
    cp $1 "$DEST"
    cp "$DEST" "thumb-$DEST"
    touch --reference="$1" "$DEST"
    if [ "$EXT" == ".jpg" ]; then
       convert -size 640x480 -resize 640x480 "$DEST" "thumb-$DEST"
       touch --reference="$1" "thumb-$DEST"
    fi
  fi
  shift
done

Must write

../../bin/process-media

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.