code: function getDirNamesForDuplicateFiles(files) {
          // Must have at least two files in list for this to make sense
          if (files.length <= 1) {
              return [];
          }
  
          // First collect paths from the list of files and fill map with them
          var map = {}, filePaths = [], displayPaths = [];
          files.forEach(function (file, index) {
              var fp = file.fullPath.split("/");
              fp.pop(); // Remove the filename itself
              displayPaths[index] = fp.pop();
              filePaths[index] = fp;
  
              if (!map[displayPaths[index]]) {
                  map[displayPaths[index]] = [index];
              } else {
                  map[displayPaths[index]].push(index);
              }
          });
  
          // This function is used to loop through map and resolve duplicate names
          var processMap = function (map) {
              var didSomething = false;
              _.forEach(map, function (arr, key) {
                  // length > 1 means we have duplicates that need to be resolved
                  if (arr.length > 1) {
                      arr.forEach(function (index) {
                          if (filePaths[index].length !== 0) {
                              displayPaths[index] = filePaths[index].pop() + "/" + displayPaths[index];
                              didSomething = true;
  
                              if (!map[displayPaths[index]]) {
                                  map[displayPaths[index]] = [index];
                              } else {
                                  map[displayPaths[index]].push(index);
                              }
                          }
                      });
                  }
                  delete map[key];
              });
              return didSomething;
          };
  
          var repeat;
          do {
              repeat = processMap(map);
          } while (repeat);
  
          return displayPaths;
      }
docs: Determine the minimum directory path to distinguish duplicate file names
  for each file in list.
  
  @param {Array.<File>} files - list of Files with the same filename
  @return {Array.<string>} directory paths to match list of files