aw0g+@ANDREW.CMU.EDU (Aaron Wohl) (03/01/91)
Matt Sorrels and I put together an archiver called amsar. It had some new message server functions for preforming an operation on all captions of a message directory at once. This is zillion times faster (especialy for delete). I will be remerging sources with the itc in a week or two and will try to get it included. Aaron amsar - AMS archiver Simple examples amsar pack mail mail.ar first 100 ;save the first 100 mail messages amsar pack -delete mail mail.ar from jack amsar unpack mail mail.ar all amsar list mail last 5 amsar dir mail.ar from "bobo the clown" asmar is utility for copying messages between ams folders and a archive file. The archive files are suitable for transfering to floppy disks and/or compressing to save space. Some more complex examples Transfer previous years to a floppy: amsar pack -delete mail mail.pak before jan-1-90 Then ftp (MUST be transfered in binary mode) the file to say, a mac. Run stuffit and make a .sit file. Split it into floppy sized chunks. Using compress: amsar pack mail - subject bogus|compress > bogus.pak.Z amsar pack -delete mail - subject bogus Note due to the way vice stores happen the above amsar|compress should not be done in one step since a vice crash might not leave eithor copy intact. Using uncompress: uncompress bogus.pak.Z|amsar unpack/create menus - from "food services" Transfer message on alt.sex from bruce and about decnet to my mailbox: amsar pack netnews.alt.sex - from bruce and subject decnet|amsar unpack mail - all Delete messages before 1990 not from cyert or libove: amsar pack -delete mail - before jan-1-90 and not \( from cyert or from libove \) > /dev/null pack foldername outputfile expr pack -delete foldername outputfile expr Messages from the named folder selected by expr are transfered to outputfile. If output file is - then output is to standard out and the chatty messages move to standard error. pack -delete will make a second pass over the ams folder and delete the selected messages after the output file has been successfully closed (and stored to vice if it is a vice file). -delete and - should not generally be combined since a process further down stream in the the pipe might abort. The foldername is found on your mspath as specified in your prefrences. If expr is not present it defaults to the expression 'all'. unpack foldernaame infile expr Messages from the named infile are loaded into the ams folder foldername. Use - for infile to read from standard in. If expr is not present it defaults to the expression 'all'. list foldername expr List the matching headers from foldername to standard out. dir pakfilename expr List the matching headers from pakfilename to standard out. delete foldername expr Delete messages matching the given expression create foldername Create a new folder rmfolder foldername Delete a folder Options: Options may appeare in any order and proceede the pack or unpack command. amsar -quiet ... - don't print anything unless there is an error amsar -yescase ... - be case sensitive in from and subject matches Expressions: <expr> ::= <term> | <expr> OR <term> | <expr> AND <term> <term> ::= FIRST number - the first number messages | LAST number - the last number messages | SINCE date - messages on or after date, format dd-mmm-yy ie 26-jun-89 | BEFORE date - messages yearler than date | FROM text - messages containing text in from field ex:from "jack stein" | SUBJECT text - messages containing text in subject ex:subject meeting | ( <expr> ) - grouped sub expression ex: not \( first 100 and last 100 \) | NOT <term> - all messages except thoughs selected by <term> Note: The expressions match the message caption. That is the match is against the strings you see when displaying the captions list in a mail program NOT against the real data in the message. So if the subject is cut because it is too long when viewing it in macmail for example then that data is not available for matching either. On the plus side it is many times faster this way. If you sent a message ams puts the person it was sent to in the sender field preceded by "=>" example: => A. Wohl@andrew.cmu.ed The text matches (subject and from) use the bsd regexp (re_comp,re_exec) regular expression matcher. Some examples: from ".*a.*n" - match names not starting with 'a' that have an 'a' preceded by an 'n' The following characters need to be quoted to amsar to not be considered regexp characters . * ( ) [ ] \ Some of these also need to be quoteed to the shell, so to match a backslash in a subject: subject \\\\ The text matches (subject and from) default to non case sensitive, use -yescase to make them case sensitive. Example: amsar -yescase pack mail - from Bob The commands and operators themselves are always case insensitive. Example: amsar -YESCASE PACK mail - froM Bob However the foldername is parsed by ams and followes amses rules, whatever they are. In the default non case sensitive mode, both the string to match on the command line and the string in the header are converted to lower case. If the match pattern is really regexp expression containing a character range spanning the lower and upper case characters (ie [Q-r] ) then the match results are unpredictable, (use yescase for such strange matches). Each term of an expression is one command line argument. So be carefull to quote multi word arguments to the shell for example: subject "meeting tuesday". Likewise be sure to quote ( and ) example: not \( from aw0g or from advisor \) Also note the spaces before and after the parentheses. When an unpack or delete operation failes in the middle (say vice goes down when half the files are unpacked), the a mark may be left saying that the folder needs to be reconstructed the next time that folder is accessed with amsar or any other ams client any temporary or partialy created work will be cleaned up. If I pack then unpack a folder is it exactly the same? No, there are two differences: a) Each message lives in an individual file. When you restore them you are the last writer. Before the sender of the message or postman would most likely have been the writer. If the message directory ever becomes damaged and is reconstructed then due to a problem in the directory rebuilder it may think you are trying to fake who sent the mail. If this happens the captions may seem to all be from the person that restored the mail. This problem doesn't seem to happen with personal folders only bboards. b) There is a table in the message directory of which messages are associated by being replies to the same original message. amsar uses some shortcuts in unpacking messages and does not maintain this informaion. No ams clients use it currently so that should not be a problem. Written by:Aaron Wohl/Special Projects/Carnegie Mellon University Special thanks to:Matt Sorrals/Special Projects/Carnegie Mellon University