public static List<Path> createInputFile(final FileSystem fs, final FileSystem stagingFs,
      final Path path, final Set<Path> toCompactDirs) throws IOException {
      // Extract the list of store dirs
      List<Path> storeDirs = new LinkedList<>();
      for (Path compactDir : toCompactDirs) {
        if (isFamilyDir(fs, compactDir)) {
          storeDirs.add(compactDir);
        } else if (isRegionDir(fs, compactDir)) {
          storeDirs.addAll(FSUtils.getFamilyDirs(fs, compactDir));
        } else if (isTableDir(fs, compactDir)) {
          // Lookup regions
          for (Path regionDir : FSUtils.getRegionDirs(fs, compactDir)) {
            storeDirs.addAll(FSUtils.getFamilyDirs(fs, regionDir));
          }
        } else {
          throw new IOException(
            "Specified path is not a table, region or family directory. path=" + compactDir);
        }
      }

      // Write Input File
      FSDataOutputStream stream = stagingFs.create(path);
      LOG.info("Create input file=" + path + " with " + storeDirs.size() + " dirs to compact.");
      try {
        final byte[] newLine = Bytes.toBytes("\n");
        for (Path storeDir : storeDirs) {
          stream.write(Bytes.toBytes(storeDir.toString()));
          stream.write(newLine);
        }
      } finally {
        stream.close();
      }
      return storeDirs;
    }
Create the input file for the given directories to compact. The file is a TextFile with each
line corrisponding to a store files directory to compact.
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/regionserver/CompactionTool.java