Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!van-bc! From: lphillips@lpami.wimsey.bc.ca (Larry Phillips) Newsgroups: comp.sys.amiga Subject: Re: PKZip Amiga arrives Message-ID: <1055@lpami.wimsey.bc.ca> Date: 17 Jan 90 03:50:32 GMT Lines: 114 Return-Path: To: van-bc!rnews In , portuesi@tweezers.esd.sgi.com (Michael Portuesi) writes: >Larry, > >could you post the source to "extract" here on the net, please? Certainly. Usage is as follows: CD to the directory containing one or more files to be extracted. All files in the directory whose names end with .zoo, .arc, .lzh, or .lhz will be extracted into a directory. If there are any files you do not wish to have extracted, you should move them out of the current directory. Each file's 'root name' will be used to make a directory to hold the extracted files, and the archive file as well as the extracted files will be placed in the new directory. If a directory already exists, that archive file will be skipped. This is a safety feature. Easy enough to change if you would rather it acted some other way. type 'extract' The current directory will be scanned for all archive files, new directories made, the archive files moved to the new directories, and extracted with the appropriate unarchiver. You will be left in the directory in which you started. Assumptions Needs rexxsupport.library. I do the loadlib for it in my startup-sequence, so I don't include it in any of the programs I write. There may be other assumptions that will cause it not to work in your particular setup. If you see any, please feel free to ask about it, giving any error messages you get. >I've been meaning to write such a program for a while now, but haven't >gotten around to it. It might be fun to have the program recognize a >whole bunch of different file types, such as shar files, uuencoded >binaries, etc. and do the right things. That sounds like a good idea. I will have to take a look at how it can be done without clobbering anything. I usually proced very carefully with binaries and sources I receive over the net, since there have been conflicts in the past with duplicate names in shar files. If it can be done safely, it would be real nifty to have it even take care of multi-part .zuu files, uudecoding each part, joining them together, and unZooing the result. Anyway, here's the source for 'extract'. ---- slice here ------------ /* extract - extract files from any archive */ fnames = showdir('','f') curdir = pragma('d') do i = 1 to words(fnames) if length(word(fnames,i)) <6 then iterate archtype = translate(substr(word(fnames,i),length(word(fnames,i))-3,4)) rootname = substr(word(fnames,i),1,length(word(fnames,i))-4) say rootname archtype if find('.ZOO .LZH .LHZ .ARC', archtype) > 0 then do if ~exists(curdir || '/' || rootname) then makedir curdir || '/' || rootname else do say 'Directory' rootname 'already exists' iterate end end else iterate if substr(curdir,length(dirname)) = ':' then dirname = curdir || rootname else dirname = curdir || '/' || rootname fullname = dirname || '/' || rootname address command mv curdir || '/' || word(fnames,i) dirname call pragma('directory', dirname) select when archtype = '.ZOO' then do address command zoo 'e//' fullname say end when archtype = '.LHZ' then address command mv fullname || '.lhz' fullname || '.lzh' when archtype = '.LZH' then address command lharc e fullname when archtype = '.ARC' then do address command arc e fullname say end end end call pragma('directory',curdir) ------ end of slice ---------- Enjoy! -larry -- "Cavett Emptor - Let the talk show host beware!" - Evan Marcus +-----------------------------------------------------------------------+ | // Larry Phillips | | \X/ lphillips@lpami.wimsey.bc.ca -or- uunet!van-bc!lpami!lphillips | | COMPUSERVE: 76703,4322 -or- 76703.4322@compuserve.com | +-----------------------------------------------------------------------+