Created
July 16, 2017 11:47
-
-
Save nicobo/4a62be0435bbbda0798809003dad2d21 to your computer and use it in GitHub Desktop.
Transfers a batch of files from Bluetooth device to the local computer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
####################### | |
## Transfers a batch of files from Bluetooth device to the local computer. | |
## Requires obexftp and perl's xpath to be installed. | |
## This script has been tested on Nokia X3. | |
####################### | |
# $srcdir is the directory to transfer to this computer | |
srcdir="/Carte mémoire/Photos" | |
# $tmpfile is the XML listing of files | |
tmpfile=`mktemp` | |
# allows deleting files from the phone after copying | |
echo -n "Copy (C) or Move (M) ? " && read erasesrc | |
case $erasesrc in | |
m|M) optget="--getdelete";; | |
*) optget="--get";; | |
esac | |
obexftp -b -l "$srcdir" > $tmpfile | |
xpath -n -q -e "//folder-listing/file/@name" $tmpfile | sed -r 's/name="(.+)"/\1/' | xargs obexftp -b -c "$srcdir" $optget | |
rm -f $tmpfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment