Spostamento di una gerarchia Maildir sotto un'altro account: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
| Line 5: | Line 5: | ||
'''SISTEMARE PROBLEM DI MAILBOX SORGENTE CON PUNTI IN NOME.COGNOME''' | '''SISTEMARE PROBLEM DI MAILBOX SORGENTE CON PUNTI IN NOME.COGNOME''' | ||
Esempio | |||
SRC_CLEAN=$(echo $SRC | tr . _) | |||
<pre> | <pre> | ||
cat | sudo tee /tmp/sposta_maildir > /dev/null <<'EOFile' | cat | sudo tee /tmp/sposta_maildir > /dev/null <<'EOFile' | ||
Revision as of 15:52, 5 February 2008
Questo script sposta tutta la posta dell'account sorgente in una sottocartella dell'account destinazione.
Uso:
sudo /tmp/sposta_maildir src_account dst_account
SISTEMARE PROBLEM DI MAILBOX SORGENTE CON PUNTI IN NOME.COGNOME
Esempio
SRC_CLEAN=$(echo $SRC | tr . _)
cat | sudo tee /tmp/sposta_maildir > /dev/null <<'EOFile'
#!/bin/bash
SRC="$1"
DST="$2"
if [ "$(id -u)" -ne "0" ]
then
echo You must be root to run this script. Aborting.
exit 127
fi
if [ -z "$1" -o -z "$2" ]
then
echo Usage: sposta_maildir src_account dst_account
exit 127
fi
if [ ! -e /home/${SRC}/Maildir ]
then
echo /home/${SRC}/Maildir does not exist. Aborting
exit 127
fi
if [ ! -e /home/${DST}/Maildir ]
then
echo /home/${DST}/Maildir does not exist. Aborting
exit 127
fi
echo Moving /home/${SRC}/Maildir to /home/${DST}/Maildir/.${SRC}
cd /home/${SRC}/Maildir
for VAR in .*
do
if [[ "$VAR" != "." && "$VAR" != ".." ]]
then
set -x
mv "$VAR" ".${SRC}$VAR"
set +x
fi
done
set -x
mkdir .${SRC}
mv cur .${SRC}
mv new .${SRC}
mv tmp .${SRC}
mv .${SRC}* /home/${DST}/Maildir
set +x
chown -R ${DST}: /home/${DST}/Maildir
EOFile