title: Azure-CLI Blob Storage remove multiple blobs
body: <p>I need to remove multiple files/blobs with the Azure-CLI. But it's not officially supported. So I wrote a for-loop to remove multiple files with the az command. It's look like this:</p>
  
  <pre><code>for i in `az storage blob list --container-name $BUCKET --output table | awk '{print $1}'| sed '1,2d' | sed '/^$/d'` ; do
      if az storage blob delete --name $i --container-name $BUCKET --output table ; then
        echo "Files inside the bucket (container) ${BUCKET} have been erased"
      else
        echo "Unable to erase the files inside the bucket (container) ${BUCKET}." &amp;&amp; exit 1
      fi
  done
  </code></pre>
  
  <p>But this doesn't work correctly and I think the loop hangs. But I don't know why.</p>
  
  <p>I hope anyone can help me. Thanks in advance.</p>
  
  <p>Edit:</p>
  
  <p>Thanks for your help. But nothing happen. I'm working on Xubuntu 17.04 and had fresh installed the azure cli.</p>
  
  <p>I get this Message, if I CTRL+C:</p>
  
  <pre><code>Error in sys.excepthook:
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/applicationinsights/channel/SenderBase.py", line 118, in send
    File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
      return opener.open(url, data, timeout)
    File "/usr/lib/python3.5/urllib/request.py", line 466, in open
  
      response = self._open(req, data)
    File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
      '_open', req)
    File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
      result = func(*args)
    File "/usr/lib/python3.5/urllib/request.py", line 1297, in https_open
      context=self._context, check_hostname=self._check_hostname)
    File "/usr/lib/python3.5/urllib/request.py", line 1254, in do_open
      h.request(req.get_method(), req.selector, req.data, headers)
    File "/usr/lib/python3.5/http/client.py", line 1107, in request
      self._send_request(method, url, body, headers)
    File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request
      self.endheaders(body)
    File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders
      self._send_output(message_body)
    File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
      self.send(msg)
    File "/usr/lib/python3.5/http/client.py", line 877, in send
      self.connect()
    File "/usr/lib/python3.5/http/client.py", line 1253, in connect
      super().connect()
    File "/usr/lib/python3.5/http/client.py", line 849, in connect
  (self.host,self.port), self.timeout, self.source_address)
    File "/usr/lib/python3.5/socket.py", line 703, in create_connection
      sock.connect(sa)
  KeyboardInterrupt
  
  Original exception was:
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/azure/cli/core/telemetry.py", line 271, in &lt;module&gt;
    File "/usr/lib/python3/dist-packages/azure/cli/core/telemetry.py", line 263, in upload_telemetry
    File "/usr/lib/python3/dist-packages/applicationinsights/TelemetryClient.py", line 55, in flush
    File "/usr/lib/python3/dist-packages/applicationinsights/channel/TelemetryChannel.py", line 71, in flush
    File "/usr/lib/python3/dist-packages/applicationinsights/channel/SynchronousQueue.py", line 39, in flush
    File "/usr/lib/python3/dist-packages/applicationinsights/channel/SenderBase.py", line 118, in send
    File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
      return opener.open(url, data, timeout)
    File "/usr/lib/python3.5/urllib/request.py", line 466, in open
      response = self._open(req, data)
    File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
      '_open', req)
    File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
      result = func(*args)
    File "/usr/lib/python3.5/urllib/request.py", line 1297, in https_open
      context=self._context, check_hostname=self._check_hostname)
    File "/usr/lib/python3.5/urllib/request.py", line 1254, in do_open
      h.request(req.get_method(), req.selector, req.data, headers)
    File "/usr/lib/python3.5/http/client.py", line 1107, in request
      self._send_request(method, url, body, headers)
    File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request
      self.endheaders(body)
    File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders
      self._send_output(message_body)
    File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
      self.send(msg)
    File "/usr/lib/python3.5/http/client.py", line 877, in send
      self.connect()
    File "/usr/lib/python3.5/http/client.py", line 1253, in connect
      super().connect()
    File "/usr/lib/python3.5/http/client.py", line 849, in connect
      (self.host,self.port), self.timeout, self.source_address)
    File "/usr/lib/python3.5/socket.py", line 703, in create_connection
      sock.connect(sa)
  KeyboardInterrupt
  </code></pre>
  
  <p>It's totaly unnecessary where I run this script. I get always the same error :-(</p>
  
  <p>--aruka</p>