#!/bin/csh -f # Usage: dmget_des descriptor_file # dmget the specified descriptor file, and all files it references. # # Some tricks are used to get all the files in the smallest # possible number of calls to dmget. # # Author: Andrew Wittenberg # Version dated 22nov2003 set name = `basename $0` if ($#argv == 0) then echo "Usage: $name descriptor_file" echo "dmgets the specified descriptor file, and all files it references." exit 1 endif if (! -f $1) then echo "$1 is not a valid descriptor file."; goto err endif # Extract unique filenames from descriptor. Then abridge, by determining # the longest matching left- and right-substrings, and replacing differing # parts by lists in braces {}. Limit length of each word to 1000 characters # so that the dmget command can handle it. set abridge = "/net/atw/util/abridge.awk ncmax=1000" set noglob set files = (`awk 'toupper($1)~"S_FILENAME" && toupper($0) !~"END OF STEPFILES" {print $3}' $1 | sed -e "s/'//g" | sort | uniq | $abridge`) unset noglob # now dmget the files if ($#files == 0) then echo "Descriptor file $1 does not reference any files."; goto err else @ i = 1 while ($i <= $#files) dmget "$files[$i]" @ i++ end endif exit 0 err: echo "$name aborted on error." exit 1