Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 1 | #include "common.h" |
| 2 | |
| 3 | int main (int argc, char **argv) |
| 4 | { |
| 5 | LIBMTP_mtpdevice_t *device; |
Linus Walleij | c86afbd | 2006-05-04 19:05:24 +0000 | [diff] [blame^] | 6 | uint32_t newid; |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 7 | |
| 8 | if(argc != 3) { |
| 9 | printf("Usage: newfolder name id\n"); |
Linus Walleij | c86afbd | 2006-05-04 19:05:24 +0000 | [diff] [blame^] | 10 | printf("(id = parent folder or 0 to create the new folder in the root dir)\n"); |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 11 | return -1; |
| 12 | } |
| 13 | |
| 14 | LIBMTP_Init(); |
Linus Walleij | c86afbd | 2006-05-04 19:05:24 +0000 | [diff] [blame^] | 15 | |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 16 | device = LIBMTP_Get_First_Device(); |
Linus Walleij | c86afbd | 2006-05-04 19:05:24 +0000 | [diff] [blame^] | 17 | |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 18 | if (device == NULL) { |
| 19 | printf("No devices.\n"); |
| 20 | exit (0); |
| 21 | } |
| 22 | |
Linus Walleij | c86afbd | 2006-05-04 19:05:24 +0000 | [diff] [blame^] | 23 | 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 Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 29 | |
| 30 | LIBMTP_Release_Device(device); |
Linus Walleij | c86afbd | 2006-05-04 19:05:24 +0000 | [diff] [blame^] | 31 | |
Linus Walleij | 9c6ca02 | 2006-04-21 10:24:15 +0000 | [diff] [blame] | 32 | printf("OK.\n"); |
| 33 | exit (0); |
| 34 | } |
| 35 | |