blob: 851ff8476bf69bb0f1151dc0c90753a017c2aac7 [file] [log] [blame]
Linus Walleij9c6ca022006-04-21 10:24:15 +00001#include "common.h"
2
3int main (int argc, char **argv)
4{
5 LIBMTP_mtpdevice_t *device;
Linus Walleijc86afbd2006-05-04 19:05:24 +00006 uint32_t newid;
Linus Walleij9c6ca022006-04-21 10:24:15 +00007
8 if(argc != 3) {
9 printf("Usage: newfolder name id\n");
Linus Walleijc86afbd2006-05-04 19:05:24 +000010 printf("(id = parent folder or 0 to create the new folder in the root dir)\n");
Linus Walleij9c6ca022006-04-21 10:24:15 +000011 return -1;
12 }
13
14 LIBMTP_Init();
Linus Walleijc86afbd2006-05-04 19:05:24 +000015
Linus Walleij9c6ca022006-04-21 10:24:15 +000016 device = LIBMTP_Get_First_Device();
Linus Walleijc86afbd2006-05-04 19:05:24 +000017
Linus Walleij9c6ca022006-04-21 10:24:15 +000018 if (device == NULL) {
19 printf("No devices.\n");
20 exit (0);
21 }
22
Linus Walleijc86afbd2006-05-04 19:05:24 +000023 newid = LIBMTP_Create_Folder(device, argv[1], atol(argv[2]));
24 if (newid == 0) {
25 printf("Folder creation failed.\n");
26 } else {
27 printf("New folder created with ID: %d\n", newid);
28 }
Linus Walleij9c6ca022006-04-21 10:24:15 +000029
30 LIBMTP_Release_Device(device);
Linus Walleijc86afbd2006-05-04 19:05:24 +000031
Linus Walleij9c6ca022006-04-21 10:24:15 +000032 printf("OK.\n");
33 exit (0);
34}
35