void cleanUpStagingDirectory(ReplicaId replicaId){
      try {
          PartitionFileStore fileStore= storeManager.getFileStore(replicaId.getPartitionId());
          fileStore.cleanUpStagingDirectory(replicaId.getReplicaPath(),
              storeConfig.storeFileCopyTemporaryDirectoryName, Long.toString(replicaId.getPartitionId().getId()));
      } catch (IOException e) {
        // if deletion fails, we log here without throwing exception. Next time when server restarts,
        // the store should complete BOOTSTRAP -> STANDBY quickly and attempt to delete this again.
        logger.error("Failed to delete {}", storeConfig.storeFileCopyTemporaryDirectoryName, e);
      } catch (Exception e) {
        // if store is not found, we log here without throwing exception. Next time when server restarts,
        // the store should attempt to delete this again and complete BOOTSTRAP -> STANDBY quickly again.
        logger.error("Failed to get File Store {}", replicaId.getPartitionId().toPathString(), e);
      }
    }
Use FileCopyTemporaryDirectoryName to create a temporary directory for file copy.
This will be used to write the files which are not yet written and can be cleaned
up without
ambry-file-transfer/src/main/java/com/github/ambry/filetransfer/FileCopyBasedReplicationSchedulerImpl.java