#!/bin/sh
# listnewfiles.sh -- list new files and images

if [ -f newpages.html ] ; then mv newpages.html newpages.html- ; fi
if [ -f newimages.html ] ; then mv newimages.html newimages.html- ; fi

rm -rf .xvpics ./*/.xvpics

for name in scan*/*
do
	if [ -f "$name" ]
	then
		ls -l "$name"
	fi
done

(
 echo '[/index]'
 echo "Recently Updated Pages"
 date
 echo
 (find ./* -type f -name '*.html' \! -name newpages.html \
	\! -path '*hidden*' \
	-printf "%TY%Tm%Td%TH%TM,%p,%TY-%Tm-%Td %TH:%TM\n" | grep -v soraya | sort -r | head -100 | \
  awk -F , '{ printf("[%s] %s\n",$2,$3) }')) | text2html > newpages.html

(
 echo '[/index]'
 echo "Recently Updated Images"
 date
 echo
 (find ./* -type f \( -name '*.gif' -o -name '*.jp*g' -o -name '*.ti*f' \) \
	\! -path '*hidden*' \
	-printf "%TY%Tm%Td%TH%TM,%p,%TY-%Tm-%Td %TH:%TM\n" | grep -v soraya | sort -r | head -100 | \
  awk -F , '{ printf("[%s;%s] %s\n",$2,$2,$3) }')) | text2html > newimages.html

ls -l newpages.html newimages.html
