title: How do you iterate through objects in a blob on google cloud storage? Python
body: <p>I am trying to figure out how to iterate over objects in a blob in google cloud storage. The address is similar to this:</p>
  
  <pre><code>gs://project_ID/bucket_name/DIRECTORY/file1 
  gs://project_ID/bucket_name/DIRECTORY/file2
  gs://project_ID/bucket_name/DIRECTORY/file3
  gs://project_ID/bucket_name/DIRECTORY/file4
  ...
  </code></pre>
  
  <p>The DIRECTORY on the GCS bucket has a bunch of different files that I need to iterate over, so that I can check when it was last updated (to see if it is a new file there) so that I can pull the contents.</p>
  
  <p>Example function</p>
  
  <pre><code>def getNewFiles():
      storage_client = storage.Client(project='project_ID')
      try:
          bucket = storage_client.get_bucket('bucket_name')
      except:
          storage_client.create_bucket(bucket_name)
  
      for blob in bucket.list_blobs(prefix='DIRECTORY'):
          if blob.name == 'DIRECTORY/':
              **Iterate through this Directory**
              **CODE NEEDED HERE***
              **Figure out how to iterate through all files here**
  </code></pre>
  
  <p>I have gone through the python api and the client library, and can't find any examples of this working..</p>