#!/usr/bin/sh
# h franks <harfranks@yahoo.com>
# to use this exec:
# find filename/ -type d -exec ./indexwrapper.sh {} \;
#TODO - accept spaces in directory names by escaping the space

#copy the perl script to every subdirectory
cp gtindex.pl $1

#enter the subdirectory
cd $1

#delete all previous index's created
rm index*

#delete all thumbnail index's created
rm tindex*x

#execute the script with title as subdirectory name and thumbnail dir as thumbs
perl gtindex.pl -vds -m thumbs  -t "$1" *

#set permissions of index and everything ( if u dont want it global then dont put it in file)
chmod -R 755 *

#remove the script from every directory
rm gtindex.pl

