Correctly extract deeply nested files.

Previously it would properly extract files nested in a single
directory but fail when dealing with deeper nesting.