#! /bin/csh -f # Last edited on 2003-10-12 15:22:06 by stolfi # Makes a list of GIF image files under the current directory set usage = "$0 DIR..." # If a subdirectory contains an image called "p.gif", show only that image # and ignore all other images in that subtree; else show all ".gif" # images below the subtree. # The "p.gif" images are listed first, then the rest; each category is # sorted by date (most recent first). set path = ( /usr/bin /bin /usr/ucb /usr/bsd ) if ( $#argv < 1 ) then echo "usage: ${usage}"; exit 1 endif set dirs = ( $* ) find ${dirs} -name '*.gif' -print \ | sed -e 's/^\.\///g' -e 's/\/\.\//\//g' \ | sort -u > .all-gifs grep '/p.gif' .all-gifs | sort > .p-gifs sed -e 's/p.gif$//g' .p-gifs | sort -u > .p-dirs if ( -z .p-dirs ) then cp .all-gifs .loners else fgrep -v -f .p-dirs .all-gifs > .loners endif if ( ! ( -z .p-gifs ) ) then /bin/ls -td1 `cat .p-gifs | sed -e 's@^\./@@'` endif if ( ! ( -z .loners ) ) then /bin/ls -td1 `cat .loners | sed -e 's@^\./@@'` endif /bin/rm -f .p-gifs .p-dirs .loners