Silly script: Download a file from the server

Thanks to Magnus the Magnificent I got a good script working to resolve links to files in thunderbird. I sometimes get e-mails pointing to a certain file. If it is not tagged with a file:/// or if it points to a remote server I just couldn’t handle the fact that it takes a couple of milliseconds to copy and paste that into some sftp terminal…

So, I got a script going… Create a shell script in your favorite bin folder (such that the path is set up to find it):

cd $dropZone
while $fileName; do
fileName=`inotifywait -e create --format "%f" $dropZone`
if [ "$fileName" = "dropped text.txt" ]
fileCont=`cat "$fileName"`
rm "$fileName"
sftp $server <<EOF
get $fileCont

and yes, you need inotifywait to get it working … So, you need to hack the snippet above to resolve the servername and username and you need some folder on the Desktop (which I call dropzone). Call the script whatever you like and launch it. If you create a launcher from the desktop, you will be able to get a pop-up window to enter any password to the server if required. If you start from terminal, it will prompt you for the password there…

Now, when I get an e-mail with, say:


the file is so much here:


Then I can just mark that text in thunderbird and drag-and-drop it on the dropzone folder, and magically (?!) the file which it is pointing to shows up in that folder…

I guess there are a couple of other ways of doing it, but at least it is a start to save those 2.3 seconds…

One thought on “Silly script: Download a file from the server

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.