in reply to Finding path to a package

  1. Find all the unique directory paths from your list.(via sorting or a hash table)
  2. Find all the unique roots (I guesss there might be more than one). (a/b/c, a/b => a/b)
  3. Having vastly diminished the number of directories to check, for each unique root,
    1. open one file in that root,
    2. find it's package declaration,
    3. and parse it to determine what the directory entry should be.
  4. Examine the results for all the unique roots to see if you can merge the results.