[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to send mails with attachments for each file in a directory ?



On Tue, Jan 29, 2008 at 07:01:47PM +0200, Jabka Atu <mashrom.head@gmail.com> was heard to say:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Good day,..
> 
> 
> since i can't send find a fast way to send many pictures to Gmail /
> ISP mail (Quata limit for single mail).
> 
> I thought it will be fun to do it in one line :
> 
> find  *.jpg -exec uuencode  '{}' '{}' |  mail someone@gmail.com \;       
> 
> but this won't work since :
> 
> 
> find: missing argument to `-exec'

  The pipe is being interpreted by the shell, so find never sees the
trailing semicolon, hence the error you get.

  If you want to do this, you can try:

find $PATH *.jpg -exec sh -c 'uuencode "$0" "$0" | mail someone@gmail.com' '{}' ';'

  which ought to do what you want.  You need to explicitly invoke a
shell because find will just pass the pipe character literally along
instead of interpreting it.

  Daniel


Reply to: