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.

  1. #!/bin/sh
  2. # Send Selected File via Bluetooth.
  3. function do_it() {
  4. bluetooth-sendto "$@"
  5. # gnome-obex-send "$@"
  6. }
  8. quoted=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | \
  9. awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | \
  10. sed -e s#\"\"##)
  11. 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.


About fnx

PSN: the_phoenix
This entry was posted in Software, Tech and tagged , , . Bookmark the permalink.

2 Responses to Send files to a bluetooth device from Linux

  1. Bernd says:

    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

  2. fnx says:

    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 *