Thursday, September 29, 2011

Re: (off-topic) Quick method of sending files from ssh to clients

If you have mutt installed (a popular text-mode mail reader/writer),
you can get the same thing done without any scripting:

$ echo 'Here you go' |mutt recipient@domain.com -s 'My subject' -a /path/to/file

:-)

On Thu, Sep 29, 2011 at 2:57 PM, Cal Leeming [Simplicity Media Ltd]
<cal.leeming@simplicitymedialtd.co.uk> wrote:
> Hey,
> Little bit off topic, but quite relevant for the busy coder.
> Often I needed to quickly grab a file off a server, or send to a client, but
> it took me 2-3 minutes to fire up an SCP client, find the file, send it etc
> etc.
> So I created a small script (depends on sendmail and uuencode/sharutils) to
> send files via email:
>  foxx@sws01.internal [~] > cat /usr/sbin/sendfile
> #!/bin/sh
> if [ -z "$1" ] || [ -z "$2" ] || [ ! -f $1 ] ; then
>     echo "syntax: [filename] [email address]"
> else
>     (echo "file attached."; uuencode $1 $1) | mail -s "file attach: $1" $2
>     echo "File sent to $2"
> fi
> Usage:
>  foxx@sws01.internal [~] > /usr/sbin/sendfile ~/lol
> cal.leeming@simplicitymedialtd.co.uk
> File sent to cal.leeming@simplicitymedialtd.co.uk
> Hopefully someone else will benefit from these 6 lines of code which saved
> me so much time :)
> Cal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

--
Bjarni R. Einarsson
Founder, lead developer of PageKite.

Make localhost servers visible to the world: http://pagekite.net/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment