diff --git a/bldpdb b/bldpdb new file mode 100755 index 0000000..bb13746 --- /dev/null +++ b/bldpdb @@ -0,0 +1,27 @@ +#!/bin/sh +# Build pdbase File Lists And Tables Of Contents + +PDBROOT=/pdbase +PDBASE=$PDBROOT/pub/000-Allfiles.txt +NEWFILES=$PDBROOT/pub/000-Newfiles.txt +UNZIP='/usr/local/bin/unzip -z' +UNIXTOOLS=/usr/bin +FMTPDB=$PDBROOT/bin/fmtpdb.awk + +# Build the master file list + +#/usr/home/tundra/.local/bin/pew in python2 $PDBROOT/bin/bldpdb.py | $UNIXTOOLS/sort >$PDBASE +$PDBROOT/bin/bldpdb.py | $UNIXTOOLS/sort >$PDBASE + + +#$UNIXTOOLS/find $PDBROOT/pub -name \*.zip -exec $UNZIP {} 2>/dev/null \;\ +#| $UNIXTOOLS/awk -f $FMTPDB | $UNIXTOOLS/sort > $PDBASE + +# Build the list of new files + +$UNIXTOOLS/find $PDBROOT/pub -name \*.zip -mtime -30 -exec $UNZIP {} 2>/dev/null \; \ +| $UNIXTOOLS/awk -f $FMTPDB | $UNIXTOOLS/sort > $NEWFILES + +# Create A Table Of Contents For Each Directory + +$PDBROOT/bin/bldtoc diff --git a/bldtoc b/bldtoc new file mode 100755 index 0000000..7744e63 --- /dev/null +++ b/bldtoc @@ -0,0 +1,33 @@ +#!/bin/sh +# Build pdbase Table-Of-Contents Files + + +ROOT="/pdbase/pub" +TOC="000_Table-Of-Contents.txt" + +cd $ROOT + +# Iterate Over All Directories + +for dir in `find ./ -type d` +do + + cd $dir + rm -f $TOC + + # Report contents of all archives + + zipfiles=`ls *.zip 2>/dev/null` + if [ -n "$zipfiles" ] + then + + for file in $zipfiles + do + /usr/local/bin/unzip -v "$file" >> "$TOC" + printf "\n\n" >> "$TOC" + done + + fi + cd $ROOT + +done diff --git a/fmtpdb.awk b/fmtpdb.awk new file mode 100755 index 0000000..f78956a --- /dev/null +++ b/fmtpdb.awk @@ -0,0 +1,15 @@ + { + baselen=length("/pdbase/pub/") + padlength = length($2) + newname = substr($2, baselen+1) + newname = "./"newname + padlen = 50 - length(newname) + padding = "" + while (padlen > 0) + { + padding = padding" " + padlen-- + } + getline + print newname padding $0 + }