Adding function to get directories and file objects in parallel