Files
scripts_serv/move-trash.sh
2025-12-19 22:56:37 +00:00

23 lines
534 B
Bash
Executable File

#!/bin/bash
# Read the message file path from aerc
while read -r filepath; do
# Get the base mail directory
maildir="$HOME/.local/share/mail"
# Extract the filename
filename=$(basename "$filepath")
# Create Trash/cur if it doesn't exist
mkdir -p "$maildir/Trash/cur"
# Move the file to Trash
if [[ -f "$filepath" ]]; then
mv "$filepath" "$maildir/Trash/cur/$filename"
echo "Moved to Trash: $filename" >&2
fi
done
# Re-index with notmuch
notmuch new >/dev/null 2>&1