Make sure to remove empty parent directories when removing artifacts.

We create these directories when we create the artifacts, so we have to
remove them when the artifacts are removed.
For safety, we do not do that for artifacts located outside of the build
directory.

Task-number: QBS-630
Change-Id: I4da91a2b940ddea6837cb881bf3dc777b71fe702
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>