public File getFileFromDataDirsIfAnyAdjuvantFileExists() {
    String[] dataDirs = IoTDBDescriptor.getInstance().getConfig().getDataDirs();
    String partialFileString =
        (sequence ? IoTDBConstant.SEQUENCE_FOLDER_NAME : IoTDBConstant.UNSEQUENCE_FOLDER_NAME)
            + File.separator
            + logicalStorageGroupName
            + File.separator
            + dataRegionId
            + File.separator
            + timePartitionId
            + File.separator
            + filename;
    for (String dataDir : dataDirs) {
      File file = FSFactoryProducer.getFSFactory().getFile(dataDir, partialFileString);
      if (file.exists()
          || new File(file.getAbsolutePath() + TsFileResource.RESOURCE_SUFFIX).exists()
          || ModificationFileV1.getNormalMods(file).exists()
          || ModificationFileV1.getCompactionMods(file).exists()
          || ModificationFile.getExclusiveMods(file).exists()
          || ModificationFile.getCompactionMods(file).exists()) {
        return file;
      }
    }
    return null;
  }
This method find the File object of current file by searching it in every data directory. If
the file is not found, it will return null.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/log/TsFileIdentifier.java