algoliasearch/src/offline/java/com/algolia/search/saas/OfflineClient.java
private JSONObject moveIndexOfflineSync(final @NonNull String srcIndexName, final @NonNull String dstIndexName) throws AlgoliaException {
        try {
            final File srcDir = getIndexDir(srcIndexName);
            final File dstDir = getIndexDir(dstIndexName);
            if (dstDir.exists()) {
                FileUtils.deleteRecursive(dstDir);
            }
            if (srcDir.renameTo(dstDir)) {
                return new JSONObject()
                    .put("updatedAt", DateUtils.iso8601String(new Date()));
            } else {
                throw new AlgoliaException("Could not move index");
            }
        } catch (JSONException e) {
            throw new RuntimeException(e); // should never happen
        }
    }
private JSONObject moveIndexOfflineSync(final @NonNull String srcIndexName, final @NonNull String dstIndexName) throws AlgoliaException {
        try {
            final File srcDir = getIndexDir(srcIndexName);
            final File dstDir = getIndexDir(dstIndexName);
            if (dstDir.exists()) {
                FileUtils.deleteRecursive(dstDir);
            }
            if (srcDir.renameTo(dstDir)) {
                return new JSONObject()
                    .put("updatedAt", DateUtils.iso8601String(new Date()));
            } else {
                throw new AlgoliaException("Could not move index");
            }
        } catch (JSONException e) {
            throw new RuntimeException(e); // should never happen
        }
    }
private JSONObject moveIndexOfflineSync ( final @ NonNull String srcIndexName , final @ NonNull String dstIndexName ) throws AlgoliaException { try { final File srcDir = getIndexDir ( srcIndexName ) ; final File dstDir = getIndexDir ( dstIndexName ) ; if ( dstDir . exists ( ) ) { FileUtils . deleteRecursive ( dstDir ) ; } if ( srcDir . renameTo ( dstDir ) ) { return new JSONObject ( ) . put ( "updatedAt" , DateUtils . iso8601String ( new Date ( ) ) ) ; } else { throw new AlgoliaException ( "Could not move index" ) ; } } catch ( JSONException e ) { throw new RuntimeException ( e ) ; // should never happen } }
Move an existing offline index.

**Warning:** This will overwrite the destination index if it exists.

**Note:** This applies both to {@link MirroredIndex} and {@link OfflineIndex} instances.

@param srcIndexName Name of index to move.
@param dstIndexName The new index name.
@return A JSON response.
Move an existing offline index .