It seems like you are trying to re-invent 'tar'.
In reply to Re^4: Getting all subpaths from a path by tybalt89 in thread Getting all subpaths from a path by ovedpo15