Retrieves remaining results by repeatedly invoking #next until
#next? returns false. Calls the given block once for each
result, which is passed as the argument to the block.
An Enumerator is returned if no block is given.
This method will make repeated API calls until all remaining results
are retrieved. (Unlike #each, for example, which merely iterates
over the results returned by a single API call.) Use with caution.
Parameter
request_limit (Integer) (defaults to: nil) — The upper limit of API requests to
make to load all files. Default is no limit.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Storage API - Class Google::Cloud::Storage::File::List (v1.57.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.57.0 (latest)](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-File-List)\n- [1.56.0](/ruby/docs/reference/google-cloud-storage/1.56.0/Google-Cloud-Storage-File-List)\n- [1.55.0](/ruby/docs/reference/google-cloud-storage/1.55.0/Google-Cloud-Storage-File-List)\n- [1.54.0](/ruby/docs/reference/google-cloud-storage/1.54.0/Google-Cloud-Storage-File-List)\n- [1.53.0](/ruby/docs/reference/google-cloud-storage/1.53.0/Google-Cloud-Storage-File-List)\n- [1.52.0](/ruby/docs/reference/google-cloud-storage/1.52.0/Google-Cloud-Storage-File-List)\n- [1.51.0](/ruby/docs/reference/google-cloud-storage/1.51.0/Google-Cloud-Storage-File-List)\n- [1.50.0](/ruby/docs/reference/google-cloud-storage/1.50.0/Google-Cloud-Storage-File-List)\n- [1.49.0](/ruby/docs/reference/google-cloud-storage/1.49.0/Google-Cloud-Storage-File-List)\n- [1.48.1](/ruby/docs/reference/google-cloud-storage/1.48.1/Google-Cloud-Storage-File-List)\n- [1.47.0](/ruby/docs/reference/google-cloud-storage/1.47.0/Google-Cloud-Storage-File-List)\n- [1.46.0](/ruby/docs/reference/google-cloud-storage/1.46.0/Google-Cloud-Storage-File-List)\n- [1.45.0](/ruby/docs/reference/google-cloud-storage/1.45.0/Google-Cloud-Storage-File-List)\n- [1.44.0](/ruby/docs/reference/google-cloud-storage/1.44.0/Google-Cloud-Storage-File-List)\n- [1.43.0](/ruby/docs/reference/google-cloud-storage/1.43.0/Google-Cloud-Storage-File-List)\n- [1.42.0](/ruby/docs/reference/google-cloud-storage/1.42.0/Google-Cloud-Storage-File-List)\n- [1.41.0](/ruby/docs/reference/google-cloud-storage/1.41.0/Google-Cloud-Storage-File-List)\n- [1.40.0](/ruby/docs/reference/google-cloud-storage/1.40.0/Google-Cloud-Storage-File-List)\n- [1.39.0](/ruby/docs/reference/google-cloud-storage/1.39.0/Google-Cloud-Storage-File-List)\n- [1.38.0](/ruby/docs/reference/google-cloud-storage/1.38.0/Google-Cloud-Storage-File-List)\n- [1.37.0](/ruby/docs/reference/google-cloud-storage/1.37.0/Google-Cloud-Storage-File-List)\n- [1.36.2](/ruby/docs/reference/google-cloud-storage/1.36.2/Google-Cloud-Storage-File-List)\n- [1.35.0](/ruby/docs/reference/google-cloud-storage/1.35.0/Google-Cloud-Storage-File-List) \nReference documentation and code samples for the Cloud Storage API class Google::Cloud::Storage::File::List.\n\nFile::List is a special case Array with additional values. \n\nInherits\n--------\n\n- Array\n\nMethods\n-------\n\n### #all\n\n def all(request_limit: nil, &block) { |file| ... } -\u003e Enumerator\n\nRetrieves remaining results by repeatedly invoking [#next](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-File-List#Google__Cloud__Storage__File__List_next_instance_ \"Google::Cloud::Storage::File::List#next (method)\") until\n[#next?](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-File-List#Google__Cloud__Storage__File__List_next__instance_ \"Google::Cloud::Storage::File::List#next? (method)\") returns `false`. Calls the given block once for each\nresult, which is passed as the argument to the block.\n\n\nAn Enumerator is returned if no block is given.\n\n\u003cbr /\u003e\n\nThis method will make repeated API calls until all remaining results\nare retrieved. (Unlike `#each`, for example, which merely iterates\nover the results returned by a single API call.) Use with caution. \n**Parameter**\n\n- **request_limit** (Integer) *(defaults to: nil)* --- The upper limit of API requests to make to load all files. Default is no limit. \n**Yields**\n\n- (file) --- The block for accessing each file. \n**Yield Parameter**\n\n- **file** ([File](./Google-Cloud-Storage-File)) --- The file object. \n**Returns**\n\n- (Enumerator)\n**Examples**\n\nIterating each file by passing a block: \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nbucket = storage.bucket \"my-bucket\"\nfiles = bucket.files\nfiles.all do |file|\n puts file.name\nend\n```\n\nUsing the enumerator by not passing a block: \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nbucket = storage.bucket \"my-bucket\"\nfiles = bucket.files\n\nall_names = files.all.map do |file|\n file.name\nend\n```\n\nLimit the number of API calls made: \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nbucket = storage.bucket \"my-bucket\"\nfiles = bucket.files\nfiles.all(request_limit: 10) do |file|\n puts file.name\nend\n```\n\n### #next\n\n def next() -\u003e File::List\n\nRetrieve the next page of files. \n**Returns**\n\n- ([File::List](./Google-Cloud-Storage-File-List))\n**Example** \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nbucket = storage.bucket \"my-bucket\"\nfiles = bucket.files\nif files.next?\n next_files = files.next\nend\n```\n\n### #next?\n\n def next?() -\u003e Boolean\n\nWhether there is a next page of files. \n**Returns**\n\n- (Boolean)\n**Example** \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nbucket = storage.bucket \"my-bucket\"\nfiles = bucket.files\nif files.next?\n next_files = files.next\nend\n```\n\n### #prefixes\n\n def prefixes()\n\nThe list of prefixes of objects matching-but-not-listed up to and\nincluding the requested delimiter.\n\n### #prefixes=\n\n def prefixes=(value)\n\nThe list of prefixes of objects matching-but-not-listed up to and\nincluding the requested delimiter.\n\n### #token\n\n def token()\n\nIf not empty, indicates that there are more files that match the\nrequest and this value should be passed to the next\n[Bucket#files](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-Bucket#Google__Cloud__Storage__Bucket_files_instance_ \"Google::Cloud::Storage::Bucket#files (method)\") to continue.\n\n### #token=\n\n def token=(value)\n\nIf not empty, indicates that there are more files that match the\nrequest and this value should be passed to the next\n[Bucket#files](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-Bucket#Google__Cloud__Storage__Bucket_files_instance_ \"Google::Cloud::Storage::Bucket#files (method)\") to continue."]]