#!/bin/csh -f # # myprog12 - script to backup multiple files # if ($#argv < 1) then echo "Please give a single file name. System reprompts on error." set tocopy = 0 while (! -f $tocopy) echo -n "file to copy ... " set tocopy = $< end else set tocopy = ($argv) endif set totsiz = 0 foreach fyle($tocopy) echo "------------------ $fyle --------------" if (! -f $fyle) then echo "Not copied - is not a plain file" continue endif if (! -w ~/logback) then echo "Not able to write to output directory" echo $0 COMMAND ABORTED break endif cp $fyle ~/logback set stats = `wc $fyle` echo "Backed up ...... size $stats[3] bytes " @ totsiz = $totsiz + $stats[3] end echo "Total size of files backed up: $totsiz"