Linux - Files - Recursively symlink files

A script to symlink all JPG image files on my file server to a flat directory accessible to DLNA enabled devices.

The files are organized in year directories, and under each year there are month directories:

-2011
--2011-01
--2011-02
--2011-03
...
-2012
--2012-01

NOTE: Duplicate symlinks are avoided by using file names like 20110102-1234_DSC…JPG or YYYYMMDD-HHMM_OriginalFileName.JPG


Script

#!/bin/bash 
 
SRC="/media/Images"
DEST="/media/SymlinkTarget"
 
# Create a symlink under $DEST for each JPG file under $SRC
find $SRC -type f | grep -i jpg | while read PATHNAME; do
  NEW="$DEST";
  echo "$NEW";
  ln -s "$PATHNAME" "$NEW";
done