title: AWS S3 cp creates undefined files
body: <p>While using the aws cli cp command to copy the files recursively, there is a bug which creates some undefined files. </p>
  
  <pre><code>aws s3 cp --recursive $HOME/$MYHOST-$MYTIMESTAMP/$MYHOST-$MYTIMESTAMP-*.xml  s3://mybucket/$MYHOST-$MYTIMESTAMP/
  </code></pre>
  
  <p>The program works fine and uploads to the specified bucket. But it also creates some undefined files outside the bucket in the root folder. This happens all the time and I have to rm (delete) those annoying undefined files.
  <a href="https://i.stack.imgur.com/1BaY2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1BaY2.jpg" alt="enter image description here"></a></p>
  
  <p>I presumed it to be a bug and then tried individually uploading the files rather than using wildcards, with the same results as the recursive, it still creates additional undefined files outside the bucket in the root folder again. And this happens only when I run a bunch of the same cp commands in a bash script. In this case the problem is intermittently showing up.</p>
  
  <pre><code>aws s3 cp  $HOME/$MYHOST-$MYTIMESTAMP/$MYHOST-$MYTIMESTAMP-hello.xml  s3://mybucket/$MYHOST-$MYTIMESTAMP/
  </code></pre>
  
  <p>However while doing it only for a single file, it doesn't show up. 
  My Cli version - </p>
  
  <blockquote>
    <p>aws-cli/1.14.34 Python/2.7.14+ Linux/4.4.104-39-default
    botocore/1.8.38</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/jJM3D.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jJM3D.jpg" alt="normal output"></a>
  Any help would be highly appreciated on this.</p>