00001 #include "common.h"
00002
00003 static void dump_folder_list(LIBMTP_folder_t *folderlist, int level)
00004 {
00005 int i;
00006 if(folderlist==NULL) {
00007 return;
00008 }
00009
00010 printf("%u\t", folderlist->folder_id);
00011 for(i=0;i<level;i++) printf(" ");
00012
00013 printf("%s\n", folderlist->name);
00014
00015 dump_folder_list(folderlist->child, level+1);
00016 dump_folder_list(folderlist->sibling, level);
00017 }
00018
00019 int main (int argc, char **argv)
00020 {
00021 LIBMTP_mtpdevice_t *device;
00022 LIBMTP_folder_t *folders;
00023
00024 LIBMTP_Init();
00025 device = LIBMTP_Get_First_Device();
00026 if (device == NULL) {
00027 printf("No devices.\n");
00028 exit (0);
00029 }
00030
00031
00032 folders = LIBMTP_Get_Folder_List(device);
00033
00034 if(folders == NULL) {
00035 printf("No folders found\n");
00036 } else {
00037 dump_folder_list(folders,0);
00038 }
00039
00040 LIBMTP_destroy_folder_t(folders);
00041
00042 LIBMTP_Release_Device(device);
00043 printf("OK.\n");
00044 exit (0);
00045 }
00046