Added check for folders with contents to api_rm