Fix directory traversal to import files first, then subdirectories.