Send files to a bluetooth device from Linux

Short and sweet, this one.  I think nautilus tries to be clever and produce a “send to bluetooth” menu option when you right-click on certain file types.  I’ve never had this work terribly well, if at all, so I’ve added the following script to my collection in ~/.gnome2/nautilus-scripts.  I called it Send via Bluetooth, but anything’ll do.

Then for any file, I can right-click and select Scripts/Send via Bluetooth and the file gets whipped to my phone.

#!/bin/sh
# Send Selected File via Bluetooth.
function do_it()  {
    bluetooth-sendto "$@"
    # gnome-obex-send "$@"
}
 
quoted=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | \
   awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | \
   sed -e s#\"\"##)
eval "do_it $quoted"

On my Fedora box, bluetooth-send comes from the gnome-bluetooth package.  Previsouly, the tool I had to use was gnome-obex-send , but that’s been superseded.


Posted

in

,

by

Comments

2 responses to “Send files to a bluetooth device from Linux”

  1. Bernd Avatar
    Bernd

    Many thanks for that! I was looking for a long time for a solution for Nemo in Linux Mint. The script works fine. The only thing is that the marked file is not selected automatically, instead of the directory is shown again where you have to select the file once more. Perhaps there is also a solution for that.

    best regards
    Bernd

  2. fnx Avatar

    Actually, I have a feeling there was supposed to be some way, but it didn’t work for me at the time. I’ll have a rummage around to see if I can find it again…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close