CB-6272 Fix subdir handling

https://issues.apache.org/jira/browse/CB-6272