procmail
[Top] [All Lists]

fileserver works, ls command does not :(

1996-04-01 08:43:48
Hi,
  Well, I found that manual page for procmailex with many examples which
  I found quite useful for getting the fileserver stuff working, so now
  I can reply with the list of addresses (the getnames command), I can
  also retrieve files from the 'fileserver' area. 

  Now, I wanted to do one more thing: to have a `send list' or 
  `send list *' or `send list *txt' command on the subject line
  that would use the provided pattern (if given, if not assume *)
  to do an `ls' command on the  fileserver directory and return that
  listing of available files to the requester. I have tried everything
  in my mind as well as variations of the procmailex examples and
  none of them works, at best the request message is kept in the
  incoming mailbox. Does anybody has a working solution? Here is
  my last trial :~(

:0
* ^Subject: send list [*0-9a-zA-Z]*
* !^X-Loop: account(_at_)the(_dot_)address
* !^From +account(_at_)the(_dot_)address
* !^Subject:.*Re:
* !^FROM_DAEMON
* !^Subject: send list .*[/.]\.
{
  MAILDIR=$HOME/systems/fileserver # chdir to the fileserver directory

  :0 fhw                   # reverse mailheader and extract name
  * ^Subject: send list
  | formail -rA "X-Loop: account(_at_)the(_dot_)address"

  FILE="$MATCH"         # the requested filename
  LS=`ls ./$FILE`

  :0 ah
  | echo $LS  | $SENDMAIL -oi -t
}

--
NAME: D. Emilio Grimaldo T.        | Communication Multimedia |   _/_/_/_/ 
EMAIL: grimaldo(_at_)sce(_dot_)philips(_dot_)nl     | Senior Software Engineer 
|   _/_/
ADDRESS: Eindhoven,The Netherlands | ph. +31 40 2722099       |  _/_/_/_/
-----------------------------------+--------------------------|  _/_/
 * * http://www.iaehv.nl/users/grimaldo/index.html :) * *     | _/_/_/_/
----------------------------------------------------------  \\v//  -------
Limited choice & Monopoly foster mediocrity & incompetence  (o o)
  -------------------------------------------------------ooO-(_)-Ooo----

<Prev in Thread] Current Thread [Next in Thread>