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!

  • Avatar

    How can I do this using jQuery Library?

  • Avatar
    Daniel Mendoza

    Hi @Xadani,

    The use of Admin API should only be used on server-side SDKs. If it was used in jQuery, this would expose your api_secret which is not advised.

    If server-side is not available, another approach would be to use client-side resources lists but would require tagging each image with a tag (in this example tagging the image with the folder that it belongs to). Then you can make a URL request that will return all the images that have that particular tag (aka folder) and parse the JSON response. More info here:

    Hope this helps!

  • Avatar
    Tarun Chauhan

    I need ful list of data upload in my account . i am trying with $api->resources(array("type" => "upload", "prefix" => ""));  but  i will returm 10 records only 

  • Avatar
    Yakir Perlin


    If you want more than 10 results per call, you can set the max_results option. (Integer, default=10. maximum=500). 

    Note that when a listing request has more results to return than max_results, the next_cursor value is returned as part of the response. You can then specify this value as the next_cursor parameter of the following listing request.


    Please let me know if it works for you.


  • Avatar
    Mohamed Abderrahmen

    Is there a way to retrieve images inside a specific folder without having other images in other subfolders of the folder specified using the API and without the Search being active.

    Remarks :
    I'm already aware of the prefix thing, that one retrieves images inside subfolders.
    I'm using an "Advanced plan" feature here the search is not active. I know that with the search it is possible to do so.
    I appreciate very much your help.

  • Avatar
    Aditi Madan

    You can use Admin API to browse resources and specify in an if condition the folder name that you would want the resources to be listed.

    But this process will go through all your resources and put in a list the resources within the folder you specified.


Please sign in to leave a comment.