title: Rename a folder in GCS using gsutil
body: <p>I can't rename an existing folder in GCS. How do I do this?</p>
  
  <p>As per the <a href="https://cloud.google.com/storage/docs/gsutil/commands/mv#renaming-bucket-subdirectories" rel="noreferrer">documentation</a>, this should be:</p>
  
  <pre><code>gsutil mv gs://my_bucket/olddir gs://my_bucket/newdir
  </code></pre>
  
  <p>However, what happens is that <code>olddir</code> is placed under <code>newdir</code>, i.e the directory structure is like this (after the call to <code>gsutil mv</code>):</p>
  
  <pre><code>my_bucket
      newdir
          olddir
  </code></pre>
  
  <p>instead of (what I would expect)</p>
  
  <pre><code>my_bucket
      newdir
  </code></pre>
  
  <p>I've tried all four combinations of putting trailing slashes or not, but none of them worked.</p>