00001 #include "common.h"
00002
00003 int main (int argc, char **argv)
00004 {
00005 LIBMTP_mtpdevice_t *device;
00006 uint32_t newid;
00007
00008 if(argc != 3) {
00009 printf("Usage: newfolder name id\n");
00010 printf("(id = parent folder or 0 to create the new folder in the root dir)\n");
00011 return -1;
00012 }
00013
00014 LIBMTP_Init();
00015
00016 device = LIBMTP_Get_First_Device();
00017
00018 if (device == NULL) {
00019 printf("No devices.\n");
00020 exit (0);
00021 }
00022
00023 newid = LIBMTP_Create_Folder(device, argv[1], atol(argv[2]));
00024 if (newid == 0) {
00025 printf("Folder creation failed.\n");
00026 } else {
00027 printf("New folder created with ID: %d\n", newid);
00028 }
00029
00030 LIBMTP_Release_Device(device);
00031
00032 printf("OK.\n");
00033 exit (0);
00034 }
00035