Last active
August 5, 2021 00:53
-
-
Save av-gantimurov/cccf64e346fc620b2f20eb2ead9596bf to your computer and use it in GitHub Desktop.
Fix munpack UTF-8 names in attachments
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/sh | |
find . -type f -iname '*X=' | while read name | |
do | |
newname=$(echo "$name" | sed 's/[[:print:]]*\/=Xutf-8XBX//I; s/X=XXX=Xutf-8XBX//gI; s/X=$//' | base64 -d ) | |
dir=$(echo $name | sed 's/\/=Xutf-8XBX[A-Za-z0-9X=/+-]\+//I') | |
mv --verbose "$name" "${dir}/${newname}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks both av-gantimurov and gilles0606 for your contributions. Simple, yet effective solutions, much appreciated even years later!