title: Hierarchical Glacier object retrieval
body: <p>I would like to restore all objects inside an Amazon S3 bucket, which is now frozen in Glacier. These are my Folders inside the bucket: </p>
  
  <p><code>
      $ aws s3 ls s3://cogrehab
                             PRE baseline/
                             PRE codes/
                             PRE logs/
                             PRE tp1/
                             PRE tp2/
      2014-05-17 20:14:00         27 about.txt
  </code></p>
  
  <p>So according to another question here <a href="https://stackoverflow.com/questions/20033651/how-to-restore-folders-or-entire-buckets-to-amazon-s3-from-glacier">How to restore folders (or entire buckets) to Amazon S3 from Glacier?</a> I proceed as follows:</p>
  
  <pre><code>aws s3 ls s3://cogrehab | awk '{print substr($0, index($0, $4))}' | xargs -I %%% -L 1 aws     s3api restore-object --restore-request Days=90 --bucket cogrehab --key "%%%"`
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>Unknown options: baseline/, PRE
  xargs: aws: exited with status 255; aborting
  </code></pre>