#!/bin/bash

# config...
MNT_PATH=/mnt/l/mnt/
ARCHIVE_PATTERN=*\(photo\)
EXT=psd
# this is here to avoid using windows find in some tontexts...
FIND=/bin/find


if [[ $1 == "" ]] ; then
	echo Error: need a list of files to process...
	exit 1
fi

# build pattern...
PATTERN="${1/.jpg/}"
shift
while [[ "$1" != "" ]] ; do
	# grow the pattern...
	PATTERN="$PATTERN\|${1/.jpg/}"
	shift
done
PATTERN=".*/\($PATTERN\)\.$EXT"

#echo $PATTERN 1>&2

# do the actual find...
cd "$MNT_PATH"

for a in $ARCHIVE_PATTERN ; do
	cd "$a"
	echo Searching: $a... 1>&2
	# find the files...
	$FIND . -iregex "$PATTERN" \
		-exec cygpath -aw \{} \;

	##for i in `$FIND . -iregex "$PATTERN"` ; do
	##	echo Found: `basename "$i"` 1>&2
	##	echo `cygpath -aw "$i"`
	##done
	cd ..
done

# vim:set sw=4 ts=4 :
