home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / util / unix / ftpscrip.tz / ftpscrip / FtpExtra / bin / ftpdoc < prev    next >
Encoding:
Text File  |  1991-08-19  |  1.4 KB  |  53 lines

  1. #!/bin/csh -f
  2.  
  3. # This script extracts the doc files (TeachText,Text,MacWrite)
  4. # From files that show up in your mirror.  I use it such that everynight
  5. # after I auto-mirror sumex, this runs and extracts the docs, so I can
  6. # browse through them if I like.  It saves me downloading the file sometimes
  7. # since I can see what it does beforehand.
  8.  
  9. # Step through each archive that is being mirrored.  In my case only,
  10. # Sumex for now.  set the docs to go in /doc below the mirror.
  11. foreach MIRROR ($FTPEXTRAS/mirror/*)
  12. set DOC = $MIRROR/doc
  13.  
  14. # If the /doc directory doesnt exist then create it.
  15. if (!(-e $DOC)) then
  16. mkdir $DOC
  17. endif
  18.  
  19. # Remove the old stuff in /doc
  20. rm -r $DOC/*
  21.  
  22. # copy anything that is stuffit format into the doc directory.  Since
  23. # I cant de-archive things like .cpt I only get the .sit. I neglect
  24. # the possibility of something that isnt archived, but rather plain
  25. # MacBinary.
  26. cp $MIRROR/*sit*bin $DOC
  27.  
  28. # Unstuff the archives.
  29. cd $DOC
  30. foreach file ($DOC/*sit*bin)
  31. echo Unstuffing... $file:t
  32. unsit $file || echo Unable to unsit... $file:t
  33. rm $file
  34. end
  35.  
  36. # Sometimes things unstuff into directories.  Move all the files
  37. # in dierctories, up into the /doc level.
  38. mv $DOC/*/* $DOC
  39.  
  40. # Pipe it into mcread. Mcread will just ignore things it cant handle.
  41. # e.g. APPL MSWD etc..
  42. foreach file (*.info)
  43. macbin $file:r
  44. rm $file:r'.info' $file:r'.rsrc' $file:r'.data'
  45. mcread $file:r'.bin' > $file:r'.doc'
  46. if (-z $file:r'.doc') then
  47. rm $file:r'.doc'
  48. endif
  49. rm $file:r'.bin'
  50. end
  51.  
  52. end
  53.