How can I list all uploaded images located on my account's Root?

The public ID of a resource which is located under a subdirectory, will contain slashes (`/`) as delimiters.

Therefore by filtering only resources which don't contain slashes, you can list all the resources which are currently on your account's root.

For example in Rails:

results = Cloudinary::Api.resources(type:"upload")
resources = results["resources"]
ids = {|res| res["public_id"]}! {|public_id| !public_id.include?("/")}

Array `ids` will now contain exactly what we've asked for.

Those resources can now be further taken care of (e.g. deleted, relocated, etc.).

Have more questions? Submit a request


Powered by Zendesk