* * Fell free to mail to siggi.gevatter@gmail.com about bugs, ideas, support, or to tell me that you like this script * * This script is Open Source Software licensed under the GNU General Public License * It comes with absolute NO warrany - use it at your own risk! * */ /* * CONFIGURATION * */ // MAC Identifier of the device $mac = '00:0A:28:61:2F:A5'; // Path of the folder on the remote device $path = 'audio/'; // Overwrite existing files? $overwrite = false; // Download all files from $path, included those from subfolders $recursive = false; // Print the data off all files (and folders) when they are found $showFound = false; /* * MAIN CODE * */ echo "\n"; $fileArray = array(); $folderArray = array(); $ignore = 0; function readRemoteFolder($path) { GLOBAL $mac, $overwrite, $recursive, $showFound; GLOBAL $fileArray, $folderArray, $ignore; // Check that the path has a slash at end and add if it hasn't, add one if(substr($path, -1) !== '/') $path = $path.'/'; // Get a list (in XML format) of all files in the directory echo 'Retrieving file list from "',$path,'"... '; $xml = shell_exec("obexftp -b $mac -l $path 2> /dev/null"); echo "OK.\n"; // Put it into an array, each line with a different key $xmlArray = split("\n", $xml); unset($xml); // Run throught all lines foreach($xmlArray AS $value) { // Check if the current line is about a file, a folder, or is just crap if(substr($value, 0, 6) !== ' // list(, $name, , $size, , $type, , $modified, , $perm) = split('"', $value); if(substr($value, 0, 6) === ' /dev/null'); echo "OK.\n"; } echo "\n\n"; ?>