Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GENERATING THE LISTS
- #!/bin/bash
- #findbox.sh 0.1 takes the below 3 parameters, required
- set timeout 10
- set hostName [lindex $argv 0]
- set userName [lindex $argv 1]
- set password [lindex $argv 2]
- #Find all folders with mbox files in them
- find . -name 'mbox' | while read LINE; do echo “$LINE” ; done | sed 's/ /\\ /g' > /tmp/dirlist
- echo A nice escaped list of paths is now in /tmp/dirlist
- #Make the inboxes on destination, dashes for spaces,
- cat /tmp/dirlist | sed 's/ /\-/g' | while read mlabel; do /tmp/makebox.sh $hostName $userName $password $mlabel ;done
- #EOF
- MAKING THE TARGET BOXES
- #!/usr/bin/expect
- #makebox.sh 0.1
- set timeout 10
- set hostName [lindex $argv 0]
- set userName [lindex $argv 1]
- set password [lindex $argv 2]
- set title [lindex $argv 3]
- spawn telnet $hostName imap
- expect -exact “Dovecot ready”
- send “A1 LOGIN $userName $password\r”
- expect -exact “Logged in”
- send “A1 CREATE INBOX.$title\r”
- expect -exact “Create completed.”
- send “A1 LOGOUT”
- #EOF
- UPLOAD THE MAILBOXES
- #!/bin/bash
- #Uploader 0.1 /tmp/upload.sh
- set hostName [lindex $argv 0]
- set userName [lindex $argv 1]
- set password [lindex $argv 2]
- oIFS=$IFS #save original IFS, must be restored!!
- IFS$`\n' #hack for displaying escaped spaced since python is picky
- #Upload mailboxes but replace spaces with dashes at the end, cut command might need a column set properly
- find . -name 'mbox' | while read -r i; do python /PATH/TO/IMAP_UPLOAD.py –user $userName –password $password “$i” imaps://$hostName/INBOX.`echo $i | cut -d/ -f2 | sed 's/ /\\-/g'`;done
- IFS=$oIFS #restore original IFS
- #EOF
- #Comein22
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement