public boolean unloadTsfile(File fileToBeUnloaded, File targetDir) throws IOException {
    TsFileResource tsFileResourceToBeMoved = unloadTsFileInside(fileToBeUnloaded);
    if (tsFileResourceToBeMoved == null) {
      return false;
    }
    tsFileResourceToBeMoved.writeLock();
    try {
      tsFileResourceToBeMoved.moveTo(targetDir);
      logger.info(
          "Move tsfile {} to target dir {} successfully.",
          tsFileResourceToBeMoved.getTsFile(),
          targetDir.getPath());
    } finally {
      tsFileResourceToBeMoved.writeUnlock();
    }
    return true;
  }
Unload tsfile and move it to the target directory if it exists.

<p>Firstly, unload the TsFileResource from sequenceFileList/unSequenceFileList.

<p>Secondly, move the tsfile and .resource file to the target directory.

@param fileToBeUnloaded tsfile to be unloaded
@return whether the file to be unloaded exists. @UsedBy load external tsfile module.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java