Nested files, dirs listing

This snippet returns all the files and all the directories in some given path (root) in two lists, the first for the files and the other for directories