title: How to upload folder from local to GCP bucket using python
body: <p>I am following this link and getting some error:</p>
  <p><a href="https://stackoverflow.com/questions/25599503/how-to-upload-folder-on-google-cloud-storage-using-python-api">How to upload folder on Google Cloud Storage using Python API</a></p>
  <p>I have saved model in container environment and from there I want to copy to GCP bucket.</p>
  <p>Here is my code:</p>
  <pre><code>storage_client = storage.Client(project='*****')
  def upload_local_directory_to_gcs(local_path, bucket, gcs_path):
  
     bucket = storage_client.bucket(bucket)
  
      assert os.path.isdir(local_path)
      for local_file in glob.glob(local_path + '/**'):
          
          print(local_file)
  
  
          
          print(&quot;this is bucket&quot;,bucket)
          blob = bucket.blob(gcs_path)
          print(&quot;here&quot;)
          blob.upload_from_filename(local_file)
          print(&quot;done&quot;)
  
  path=&quot;/pythonPackage/trainer/model_mlm_demo&quot; #this is local absolute path where my folder is. Folder name is **model_mlm_demo**
  buc=&quot;py*****&quot; #this is my GCP bucket address
  gcs=&quot;model_mlm_demo2/&quot; #this is the new folder that I want to store files in GCP
  
  upload_local_directory_to_gcs(local_path=path, bucket=buc, gcs_path=gcs)
  </code></pre>
  <p><code>/pythonPackage/trainer/model_mlm_demo</code> has 3 files in it config, model.bin and arguments.bin`</p>
  <p><strong>ERROR</strong></p>
  <p>The codes doesn't throw any error, but there is no files uploaded in GCP bucket. It just creates empty folder.</p>
  <p><a href="https://i.stack.imgur.com/DZK93.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DZK93.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/6m0Cm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6m0Cm.png" alt="enter image description here" /></a></p>