     delete @deviceProcesses[uuid]
     callback null, uuid
 
+  removeDeletedDeviceDirectory: (device, callback) =>
+    fs.remove @getDevicePath(device), (error) =>
+      console.error error if error?
+      callback()
+
   stopDevices: (callback=->) =>
     async.each @runningDevices, @stopDevice, callback
 

  setupDevice: (device, callback) =>
    debug 'setupDevice', {uuid: device.uuid, name: device.name}

    devicePath = path.join @config.devicePath, device.uuid
    connectorPath = path.join @config.tmpPath, 'node_modules', device.connector

    debug 'path', devicePath

    debug 'requesting device', deviceUrl, 'auth:', authHeaders

    request url: deviceUrl, headers: authHeaders, json: true, (error, response, body) =>
      return callback(error, null) if error? || body.error?
      device = _.extend {}, body.devices[0], device
      debug 'device exists', device.name
      callback null, device

  getDevicePath: (device) =>
    path.join @config.devicePath, device.uuid

  startDevice : (device, callback=->) =>
    debug 'startDevice', { name: device.name, uuid: device.uuid}
    devicePath = @getDevicePath device
    @writeMeshbluJSON devicePath, device

    pathSep = ':'
