parcel-builder put image in sub folder

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// Function to build the parcel with an image in a subfolder
void buildParcelWithImage(const char imagePath, const char subfolder) {
    // Create the subfolder if it doesn't exist
    char mkdirCommand[100];
    sprintf(mkdirCommand, "mkdir -p %s", subfolder);
    system(mkdirCommand);

    // Get the image filename from the full path
    const char *imageFilename = strrchr(imagePath, '/');
    if (imageFilename == NULL) {
        imageFilename = imagePath;
    } else {
        imageFilename++; // Move past the '/'
    }

    // Create the destination path for the image in the subfolder
    char destinationPath[100];
    sprintf(destinationPath, "%s/%s", subfolder, imageFilename);

    // Copy the image to the subfolder
    char copyCommand[200];
    sprintf(copyCommand, "cp %s %s", imagePath, destinationPath);
    system(copyCommand);

    // Print a success message
    printf("Image '%s' successfully placed in subfolder '%s'.\n", imageFilename, subfolder);
}

int main() {
    // Provide the path to the image and the subfolder name
    const char *imagePath = "/path/to/your/image.jpg";
    const char *subfolder = "images";

    // Build the parcel with the image in the subfolder
    buildParcelWithImage(imagePath, subfolder);

    return 0;
}