delete dir middleware