home *** CD-ROM | disk | FTP | other *** search
- #!/bin/awk
- #
- # Suggested usage: set capacity=`... | awk -f fnFilter.awk argFile=<filename>`
- #
- # This is a fundamental component of the 8mmbackup system.
- #
- # This awk filter takes 'ls -gild .<path>' (and 'find -ls .<path>') format (as
- # of bsd 4.2 Unix, Sun OS 3.5) from stdin and prints the filenames into
- # designated 'argFile', returning total disk capacity encompassed by the files
- # as the value. Note that the leading '.' on the path argument is critical.
- #
- # Specific provisions have been made for names with embedded blanks and
- # 'ls -gild' symbolic-link format.
- #
-
- BEGIN {tally = 0}
-
- # Symbolic links:
- / -> / { beg=index($0,"./");
- print substr($0,beg,index($0," ->")-beg) > argFile }
-
- # Non-symbolic links:
- ! / -> / { beg=index($0,"./"); print substr($0,beg,length-beg+1) > argFile }
-
- # Accumulate tally
- {tally = tally + $7}
-
- END {print tally}
-