Friday, November 24, 2017

send and receive file via bluetooth from command line

1- install bluez and obexftp
$ sudo apt-get install bluez obexftp

2- pairing
$ sudo bluetoothctl
agent on

scan on
pair 00:25:00:ff:ee:01

2- after the devices are paired we can send file using obexftp with command below
$ obexftp -b 00:25:00:ff:ee:01 -p filename

3- to list directory
$ obexftp -b 00:25:00:ff:ee:01 -c / -l
Browsing 00:25:00:ff:ee:01 ...
Sending ""...|done
Receiving "(null)".../<?xml version="1.0"?>
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd">
<folder-listing version="1.0">
 <folder name="Internal storage"/>

or list the "Internal storage"

$ obexftp -b 00:25:00:ff:ee:01 -c "Internal storage" -l

4- then we can get the file with below command
$ obexftp -b 00:25:00:ff:ee:01 -c "Internal storage" -g filename

No comments:

Post a Comment