#!/bin/csh -f
# distribute files from ~ccdoper/user/images to their proper places
# also manage the copies for web access

set log = ~ccdoper/DISTIMAGES.LOG
echo -n "distimages running " >>& $log
date >>& $log

# move to the correct directory
cd ~ccdoper/user/images

# where we put things for web access
set webdir = "/lucifer/astrolabs/labimage/webimages"

# remove all webimages older than 7 days
find $webdir -type f -mtime +7 -exec echo rm {} \; >>& $log
find $webdir -type f -mtime +7 -exec rm {} \;

# copy all local images to webimages, preserving dir structure.
find . -print | cpio -pdu $webdir

# now mv files to their real homes
ls | /usr/local/bin/distimages.nawk >>& $log
