# It's local UN.NET stuff but may be helpful for you as well!
#
# I use the ix/MBox command "uudecode from-to" to locate and uudecode
# pictures in the newsgroup "alt.binaries.pictures.supermodels" (my users
# LOVE those pictures). 
#
# The uudecoded pictures are spooled in "/tmp/.uud". That's the place where
# this script looks for the pics. It copies them to "_PATH" and then creates
# a news article in the newsgroup "_GROUP" ...
#
# Strange, I know, but a very convenient way to fill file areas as well ;-)


_GROUP="local.pd.pictures"		# which newsgroup ?

_DATE=`date`				# just for the Message-ID
_PATH="/usr2/pd/pictures"		# where are the PD/freeware-files ?

cd /tmp/.uud
rm *.UUDE*
rm .xvpics/*

for i in *		
	do
		cp $i $_PATH
	
		_DATE=`date`	
		echo $_DATE > ../instpd.d1			
		sed '/ /s//./g' < ../instpd.d1 >../instpd.d2	# building an RFC-conform Message-ID
	
		echo "From: pd-service@unnet.w.open.de" > ../instpd.tmp
		echo "Newsgroups: "$_GROUP >> ../instpd.tmp
		echo "Distribution: local" >> ../instpd.tmp
		echo "Subject:" $i >> ../instpd.tmp
		echo "Keywords:" `ff $i` >> ../instpd.tmp
		echo "Message-ID: <"`cat ../instpd.d2`"@unnet.w.open.de>" >> ../instpd.tmp
		echo >> ../instpd.tmp
		echo "BINFILE" >> ../instpd.tmp
		echo $_PATH/$i >> ../instpd.tmp
                
		echo -n Sending $i ...
		/usr/lib/news/inews -h < ../instpd.tmp
		echo done.	
	done

rm ../instpd.d*
rm ../instpd.tmp

sleep 60 

rm * 

/local/mbox/mb-daemon $_GROUP &


_GROUP="adult.pictures"			# which newsgroup ?

_DATE=`date`				# just for the Message-ID
_PATH="/usr2/pd/pictures"		# where are the PD/freeware-files ?

cd /tmp/.uud/.ad

for i in *		
	do
		cp $i $_PATH
	
		_DATE=`date`	
		echo $_DATE > ../instpd.d1			
		sed '/ /s//./g' < ../instpd.d1 >../instpd.d2	# building an RFC-conform Message-ID
	
		echo "From: pd-service@unnet.w.open.de" > ../instpd.tmp
		echo "Newsgroups: "$_GROUP >> ../instpd.tmp
		echo "Distribution: local" >> ../instpd.tmp
		echo "Subject:" $i >> ../instpd.tmp
		echo "Keywords:" `ff $i` >> ../instpd.tmp
		echo "Message-ID: <"`cat ../instpd.d2`"@unnet.w.open.de>" >> ../instpd.tmp
		echo >> ../instpd.tmp
		echo "BINFILE" >> ../instpd.tmp
		echo $_PATH/$i >> ../instpd.tmp
                
		echo -n Sending $i ...
		/usr/lib/news/inews -h < ../instpd.tmp
		echo done.	
	done

rm ../instpd.d*
rm ../instpd.tmp

sleep 60 

rm * 

/local/mbox/mb-daemon $_GROUP &

