Add two script to automate tagging mail with notmutch
This commit is contained in:
		
							parent
							
								
									05b08f4247
								
							
						
					
					
						commit
						75d5bee8ac
					
				|  | @ -0,0 +1,25 @@ | |||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| notmuch new | ||||
| 
 | ||||
| folderlist=$(find ~/.mail/ -mindepth 1 -type d -printf '\n%P\n' | grep -v -E 'INBOX|Sent|Drafts|new|cur|tmp|notmuch' | sort) | ||||
| folders="$(echo "$folderlist" | grep -v '\.') $(echo "$folderlist" | grep '\.')" | ||||
| mailboxes="mailboxes" | ||||
| 
 | ||||
| # Tag by folder | ||||
| for folder in INBOX Sent Drafts $folders | ||||
| do | ||||
|   mailboxes="$mailboxes \"+$folder\"" | ||||
|   tags=$(echo "${folder,,}" | tr -c '[[:alnum:]]' ' ' | sed -e 's/^ *//' -e 's/ *$//') | ||||
|   tagstring=+${tags// /" +"} | ||||
|   if [[ $folder != INBOX ]]; then | ||||
|     tagstring="$tagstring -inbox" | ||||
|   fi | ||||
|   #echo $tagstring | ||||
| 
 | ||||
|   notmuch tag $tagstring folder:"$folder" | ||||
| done | ||||
| 
 | ||||
| echo "$mailboxes" > ~/.mutt/mailboxes | ||||
| 
 | ||||
| exit 0 | ||||
		Loading…
	
		Reference in New Issue