Usually if there are characters in a filename that are metacharacters - they mean something to the shell - you can surround the filename with double quotes or single quotes (tic) and copy the file or rename it. To remove the last 4 chars in the filename means you have to feed it to the mv command. Which the same as feeding it to a cp command
Try something like this to rename the files:
Code:
#!/bin/bash
ls ./maildir |
while read filename
do
len=${#filename}
len=$(( $len - 4 ))
printf "mv '%s' '%s'" "${filename}" "${filename:0:$len}"
done > tmp.sh
chmod +x tmp.sh
tmp.sh
TEST this first.