#!/bin/csh -f set me=$0:t # the name of this program goto Start ###################################################################### Usage: cat << END_BLAHBLAH $me sitename Applies time stamps to html files in each dir of the named website. An html file is deemed to need a timestamp if it was modified more recently than a predetermined reference file in the dir. Allowed sitenames: ati sr END_BLAHBLAH exit ###################################################################### Start: if (! ${?DATE_FORMAT_ATI_REV_DATE}) then echo ${me}: DATE_FORMAT_ATI_REV_DATE environment variable not set\! exit endif if ($# < 1) then goto Usage endif # go to the desired directory # (Add other directories and their tags here, as needed) set theSite = $1 if ($theSite == "ati") then set topDir = "~/Sites/ati" else if ($theSite == "sr") then set topDir = "~/Sites/suttareadings" else if ($theSite == "pwd") then ; else goto Usage endif logsite ${me} "[$topDir]: " $* # make a note of this invocation set reference_File = ".REV_DATE" # the file against which we compare the mod dates # bring the ati tech files up to date if ($theSite == "ati") then sync-scripts; echo " " build_includes_index; echo " " build_url-lists; echo " " build_pdf-list; echo " " # dtp-progress; echo " " endif localize online cd $topDir set dirList = `find . -type d \! -name .\*` # build a list of dirs echo "Found $#dirList directories. Searching for modified html files..." set nCount = 0; foreach d (. $dirList) # for each dir echo -n "." pushd $d >& /dev/null # go there set htmlList=`find . -name \*html -maxdepth 1` # list the html files there foreach h ($htmlList) # for each html file... if (-M $h > -M $reference_File) then #if it's newer than the ref file stamp_rev-date $h # then time-stamp it. @ nCount ++ # increment the counter endif end # touch $reference_File # update this dir's reference file popd >& /dev/null end echo echo "Found and time-stamped $nCount files." if ($theSite == "ati") then cat << END_INPUT ********************************************** * * * Don't forget to run 'makebulk' * * * * Have you rebuilt the search index lately? * * * ********************************************** END_INPUT endif bye: echo $me done. exit