How to list all images within a folder?




  • Avatar
    cuma elp

    is there any php sample for this?

  • Avatar
    Nadav Ofir

    The following is the equivalent in PHP:

    $api->resources(array("type" => "upload", "prefix" => "my_folder/"));

  • Avatar
    cuma elp

    i wish there's a thank u or vote button.
    anyway, thank u for your help. i'll try this later

  • Avatar
    Chester Copperpot

    is there a way to get the transformed image urls for the photos in that folder?

  • Avatar
    Nadav Ofir

    Chester, This will require writing a short script:
    First you will have to list all resources within the folder.
    Then, for every public ID, you will be able to list all of its transformed versions using the resource() method

    If you need any additional assistance, feel free to open a support ticket.

  • Avatar

    Hello can someone help me out.

    I'm new to Cloudinary and using the service for delivering image http url's for delivering to a webshop service. The will read them one time only to fill their databas.

    Can i make a list with all my uploaded pictures in Cloudinary and export or see the image url all together.

    I can now only get the links when i click them one by one.

  • Avatar
    Nadav Ofir

    Exporting such a list requires using the Admin-API. It's on our roadmap to add UI support for this task as well.
    If you're having difficulties getting this done, feel free to open a support ticket and we'll be happy to assist.

  • Avatar
    Mark Gavagan

    SIMPLE: While in your media library, once you're in the right folder or have the right images displayed, select the one on the top-right, scroll down and (Mac) hold shift while selecting the last image in the group, and all in between are selected automatically.

  • Avatar

    Sir , I can neither code in PHP nor in Node.js, is there any other way of achieving this? ANy ETA on the UI feature implementation?
    Its stopping my business deliverable and I would urgently need the list of image URLs in csv/text format.
    Is there any work around for this issue?

  • Avatar

    Or leave it, I dont have time and didnt get support from cloudinary so Ive found a workaround with zero coding efforts.
    Thanks :)

  • Avatar
    Nadav Ofir

    Hi dear users,

    While we don't yet have an ETA for this functionality, you can rest assure that we will update here as soon as this becomes available.

  • Avatar
    Gex Tecnologia

    Can I list every file of a folder? I tried that way and returns only images:

    (In PHP)
    $api->resources(array("type" => "upload", "prefix" => "folder1/folder2/"));

    But i want that bring me images, videos and raw files at same time. It can be done?

  • Avatar
    Nadav Ofir

    Hi, currently this kind of task requires making 3 separate API calls and then merging the results.

  • Avatar
    Amol Bapat

    Thanks for this, for others, this response that api returns, is enough to get the list of URLs into any type of file by some coding. You just need to pick up the URLs from the response and insert into your DB and then do some coding to achieve what you need.

  • Avatar

    Here is how you use PHP to show all images in a folder....

    $api = new \Cloudinary\Api();
    $resources = ((array) $api->resources(["type" => "upload", "prefix" => "projects/test"])['resources']);
    foreach ($resources as $resource) {
    echo cl_image_tag($resource['public_id']);

  • Avatar

    hi everyone, do you have any advices for ROR ? 

  • Avatar
    Maor Gariv

    Hi Vincent,

    Thanks for reaching out.



    This code in Rails will iterate and print all public_ids from the response  - 


    results = Cloudinary::Api.resources(type:"upload",prefix:"<PREFIX>")
    results['resources'].each {|resource| puts resource['public_id']}


    Hope it helps!

  • Avatar


    How to get the list of images in folder in Android?

  • Avatar
    Martin Cazares

    In the Java API it seems like the "prefix" parameter is being ignored, I can't fetch by folder/prefix and after looking into the code I noticed that this is what the API has:


    public ApiResponse resource(String public_id, Map options) throws Exception {
    if (options == null) options = ObjectUtils.emptyMap();
    String resourceType = ObjectUtils.asString(options.get("resource_type"), "image");
    String type = ObjectUtils.asString(options.get("type"), "upload");

    ApiResponse response = callApi(HttpMethod.GET, Arrays.asList("resources", resourceType, type, public_id),
    ObjectUtils.only(options, "exif", "colors", "faces", "coordinates",
    "image_metadata", "pages", "phash", "max_results"), options);

    return response;

    Notice that:

    ObjectUtils.only(options, "exif", "colors", "faces", "coordinates",
    "image_metadata", "pages", "phash", "max_results")

    Doesn't include prefix...


    Is there a version of the java API that includes it? I really need it...


    Thanks in Advance

  • Avatar
    Marissa Masangcay

    Hi Martin,

    You want to use our 'resources' method instead of our 'resource' method. If you take a look at our Github you will see that "prefix" is included in our 'resources' method. :)

    So you should be able to make a java call like so:

    cloudinary.api().resources(ObjectUtils.asMap("prefix", "test/folder/", "type", "upload"));

    Hope this helps!

Please sign in to leave a comment.