Index: /branches/amp_3_7_2/scripts/export_es_snapshot.sh
===================================================================
--- /branches/amp_3_7_2/scripts/export_es_snapshot.sh	(revision 2894)
+++ /branches/amp_3_7_2/scripts/export_es_snapshot.sh	(working copy)
@@ -177,12 +177,12 @@
 # ============================================================
 # CREATE SNAPSHOT
 # ============================================================
-log "Creating local snapshot: $SNAP_NAME (indices=acm_syslog-*)"
+log "Creating local snapshot: $SNAP_NAME (indices=acm_*)"
 
 SNAP_RESPONSE=$(curl -s -X PUT \
   "http://${ES_HOST}:${ES_PORT}/_snapshot/${REPO_NAME}/${SNAP_NAME}?wait_for_completion=true" \
   -H "Content-Type: application/json" \
-  -d "{\"indices\":\"acm_syslog-*\",\"ignore_unavailable\":true,\"include_global_state\":false}")
+  -d "{\"indices\":\"acm_*\",\"ignore_unavailable\":true,\"include_global_state\":false}")
 
 echo "$SNAP_RESPONSE" >> "$EXPORT_LOG"
 
@@ -195,6 +195,35 @@
 log "Snapshot created successfully: $SNAP_NAME"
 
 # ============================================================
+# CLEANUP OLD SNAPSHOTS (keep only the latest one)
+# ============================================================
+log "Cleaning up old snapshots (keeping only: $SNAP_NAME)..."
+
+# Get list of all snapshots in the repository
+ALL_SNAPS=$(curl -s "http://${ES_HOST}:${ES_PORT}/_snapshot/${REPO_NAME}/_all" | \
+    grep -oP '"snapshot"\s*:\s*"\K[^"]+' 2>/dev/null)
+
+# Delete all snapshots except the current one
+DELETED_COUNT=0
+for OLD_SNAP in $ALL_SNAPS; do
+    if [[ "$OLD_SNAP" != "$SNAP_NAME" ]]; then
+        log "Deleting old snapshot: $OLD_SNAP"
+        DEL_RESPONSE=$(curl -s -X DELETE "http://${ES_HOST}:${ES_PORT}/_snapshot/${REPO_NAME}/${OLD_SNAP}")
+        if echo "$DEL_RESPONSE" | grep -qi '"acknowledged":true'; then
+            ((DELETED_COUNT++))
+        else
+            log "WARNING: Failed to delete snapshot $OLD_SNAP: $DEL_RESPONSE"
+        fi
+    fi
+done
+
+if [[ $DELETED_COUNT -gt 0 ]]; then
+    log "Deleted $DELETED_COUNT old snapshot(s)"
+else
+    log "No old snapshots to clean up"
+fi
+
+# ============================================================
 # REMOTE EXPORT (optional)
 # ============================================================
 if [[ -n "$REMOTE_IP" ]]; then
Index: /branches/amp_3_7_2/scripts/import_es_snapshot.sh
===================================================================
--- /branches/amp_3_7_2/scripts/import_es_snapshot.sh	(revision 2894)
+++ /branches/amp_3_7_2/scripts/import_es_snapshot.sh	(working copy)
@@ -104,7 +104,7 @@
 [[ -z "$INDEX_FILE" ]] && fail "No index-* file found on remote AMP"
 
 SNAP_NAME=$(sshpass -p "$AMP_PASS" ssh $SSH_OPTS \
-  "$AMP_USER@$AMP_IP" "grep -Po '\"name\"\\s*:\\s*\"\\K[^\"]+' $INDEX_FILE | head -1"
+  "$AMP_USER@$AMP_IP" "grep -Po '\"name\"\\s*:\\s*\"\\K[^\"]+' $INDEX_FILE | tail -1"
 )
 
 [[ -z "$SNAP_NAME" ]] && fail "Failed to extract snapshot name"
@@ -325,7 +325,15 @@
         sleep 2
     done < "$TMP_LIST"
 
+    # Cleanup for date-range restore
+    log "Cleaning up import artifacts..."
+    curl -s -XDELETE "http://localhost:9200/_snapshot/$REPO_NAME" >/dev/null 2>&1
+    # Clean up ALL import directories (no parallel imports supported)
+    find "$LOCAL_SNAPSHOT_DIR" -maxdepth 1 -type d -name "import_*" -exec rm -rf {} \; 2>/dev/null
+    rm -f "$TMP_LIST" 2>/dev/null
+
     log "DATE RANGE RESTORE COMPLETED"
+    log "Cleanup completed. All temporary import files removed."
     exit 0
 fi
 
@@ -377,9 +385,42 @@
     fail "Restore PASS 2 failed"
 fi
 
+# ----------------------------------------------------------
+# STEP 10 — CLEANUP
 # ----------------------------------------------------------
+log "[10/10] Cleaning up import artifacts..."
+
+# Delete the temporary snapshot repository from Elasticsearch
+log "Deleting temporary snapshot repository: $REPO_NAME"
+REPO_DELETE=$(curl -s -XDELETE "http://localhost:9200/_snapshot/$REPO_NAME" 2>&1)
+if echo "$REPO_DELETE" | grep -qi '"acknowledged":true'; then
+    log "Snapshot repository deleted successfully"
+else
+    log "WARNING: Failed to delete snapshot repository (non-fatal): $REPO_DELETE"
+fi
+
+# Remove the import directory (contains copied snapshot data)
+if [[ -d "$IMPORT_DIR" ]]; then
+    log "Removing import directory: $IMPORT_DIR"
+    rm -rf "$IMPORT_DIR" && log "Import directory removed" || log "WARNING: Failed to remove import directory"
+fi
+
+# Clean up ALL old import directories (no parallel imports supported)
+log "Cleaning up all import directories..."
+OLD_COUNT=$(find "$LOCAL_SNAPSHOT_DIR" -maxdepth 1 -type d -name "import_*" 2>/dev/null | wc -l)
+if [[ "$OLD_COUNT" -gt 0 ]]; then
+    find "$LOCAL_SNAPSHOT_DIR" -maxdepth 1 -type d -name "import_*" -exec rm -rf {} \; 2>/dev/null
+    log "Removed $OLD_COUNT import directories"
+else
+    log "No import directories to clean up"
+fi
+
+# Remove temporary index list file
+rm -f "$TMP_LIST" 2>/dev/null
+
+# ----------------------------------------------------------
 # COMPLETION
 # ----------------------------------------------------------
 log "=========== SNAPSHOT RESTORED SUCCESSFULLY ==========="
-log "Import directory: $IMPORT_DIR"
+log "Cleanup completed. All temporary import files removed."
 exit 0
\ No newline at end of file
