#/usr/local/bin/perl
#We wanted to be able to provide a listing of new/recently changed items
#in our Gopher server. The attached script is the tool I developed to
#provide this. It generates a link file, so the listing is a directory,
#not a flat file. The user-visible name is carried over.
#
#Usage: newitems /disk/path/name -#daysold server.domain.name #port
#
#The link file it generates is called .newlinks in the current directory.
#If you place a file called .nonew in a directory, that directory is skipped.
#If you place a file called .topnew in a directory, that directory will be
#listed if any new files are found in that directory or its subdirectories.
#This script depends on the gopherls tool which is a link to the gopherd
#program, starting with version (approx) 1.0. You'll obviously be needing
#Perl.
#
#This script seems to be working for me, but hasn't been tested exhaustively.
#
#Dennis
## newitems, boone, 09/30/92
# Generate a link file listing new items in the last n days
# Copyright (C) 1992, Trustees of Michigan State University
#
# Modifications:
# 09/30/92 Boone Initial coding
# 10/01/92 Boone Added ability to exclude individual directories
# End Modifications
sub base
{
local($path) = @_;
local($pathsep) = rindex($path, "/");
if ($pathsep < 0)
{
return $path;
}
else
{
$wanted = substr($path, $pathsep+1);
return $wanted;
}
}
# Determine whether this item is part of a subtree which wants to be
# announced as a single new entry if any file in it has changed. <pant>
# Example: /news/newspapers/state_news contains a file called .topnew,
# indicating that any file in the state news subtree will cause the
# /news/newspapers/state_news entry to be listed once in the new items
# list.