Last active
November 19, 2015 13:04
-
-
Save mattanja/1367bc04750dd105317f to your computer and use it in GitHub Desktop.
Rename all files in a dovecot Maildir removing the "T" flag (T=Trash)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# (c) 2015 Mattanja Kern <mattanjakern.de> | |
# | |
# DOVECOT Maildir remove T="Trash" flag from all files in folders. | |
# | |
removeTrashFromFileName() { | |
rename 's/(.+),ST$/$1,S/' "$1" | |
rename 's/(.+),RST$/$1,RS/' "$1" | |
rename 's/(.+),STa$/$1,Sa/' "$1" | |
rename 's/(.+),STab$/$1,Sab/' "$1" | |
} | |
export -f removeTrashFromFileName | |
find ./ -type f -regex '.*,\(ST\|RST\|STa\|STb\|STab\)' -exec bash -c 'removeTrashFromFileName "{}"' \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment