proper dir extraction