#!/usr/bin/env python
import obexftp
import re
from xml.etree.ElementTree import (ElementTree, Element, SubElement, XML)
# Set up my phone address and OBEX channel
dev = "AA:BB:CC:DD:EE:FF"
chan = 16
# Define the bluetooth client
cli = obexftp.client(obexftp.BLUETOOTH)
# Connect to the client
print "Connecting to %s on channel %d" % (dev,chan)
cli.connect(dev, chan)
# Get the list of files from the SD card picture dir
files_xml = cli.list('/MMC(Removable)/motorola/shared/picture/')
folder_listing = XML(files_xml)
files = folder_listing.findall('./file/')
for file in files:
print file.get('name')
# Disconnect and delete the client
cli.disconnect()
cli.delete