I'm about to move some IMAP accounts to another server. The old server was setup to add the prefix .INBOX. to each folder, but not the new one . So I tried to rename all folders, stripping the .INBOX. prefixes.
What I did in bash:
for name in .INBOX.*;
do
newname="$(echo "$name" | cut -c8-)";
mv '$name' '$newname';
done
But this script did only rename such folders which didn't contain whitespaces. The ones with whitespaces lead into error messages.
What's the trick?