home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh -f
-
- # This script extracts the doc files (TeachText,Text,MacWrite)
- # From files that show up in your mirror. I use it such that everynight
- # after I auto-mirror sumex, this runs and extracts the docs, so I can
- # browse through them if I like. It saves me downloading the file sometimes
- # since I can see what it does beforehand.
-
- # Step through each archive that is being mirrored. In my case only,
- # Sumex for now. set the docs to go in /doc below the mirror.
- foreach MIRROR ($FTPEXTRAS/mirror/*)
- set DOC = $MIRROR/doc
-
- # If the /doc directory doesnt exist then create it.
- if (!(-e $DOC)) then
- mkdir $DOC
- endif
-
- # Remove the old stuff in /doc
- rm -r $DOC/*
-
- # copy anything that is stuffit format into the doc directory. Since
- # I cant de-archive things like .cpt I only get the .sit. I neglect
- # the possibility of something that isnt archived, but rather plain
- # MacBinary.
- cp $MIRROR/*sit*bin $DOC
-
- # Unstuff the archives.
- cd $DOC
- foreach file ($DOC/*sit*bin)
- echo Unstuffing... $file:t
- unsit $file || echo Unable to unsit... $file:t
- rm $file
- end
-
- # Sometimes things unstuff into directories. Move all the files
- # in dierctories, up into the /doc level.
- mv $DOC/*/* $DOC
-
- # Pipe it into mcread. Mcread will just ignore things it cant handle.
- # e.g. APPL MSWD etc..
- foreach file (*.info)
- macbin $file:r
- rm $file:r'.info' $file:r'.rsrc' $file:r'.data'
- mcread $file:r'.bin' > $file:r'.doc'
- if (-z $file:r'.doc') then
- rm $file:r'.doc'
- endif
- rm $file:r'.bin'
- end
-
- end
-