Fix: Purge command did not check permission for the tree to operate on

it returned just a long list of failures. Now it properly checks permissions before trying.