[ILUG] Script to move Maildir content

Michael Kennedy Info at KennedySoftware.ie
Tue Jul 7 13:30:07 IST 2009


Patrick,

> Thanks for all the responses, it looks like I'll be building a bash script
> alright. I have the bulk of the mails backed up onto the new machine so
> won't need to be doing a big transfer across the network. Any mails since
> the backup will be brought across by modifying the script to only include
> mails from a certain date.

Seems more-and-more like "the script" is a once-off, and will be tweaked 
on-the-fly "as needed". In which case no stress-testing, 
bullet-proofing, error-checking, etc, applies, and in which case the 
most economical set of commands should be adopted - as suggested by the 
others here.

At the other end of the scale, say in a "production" environment, a 
"script" would need to be much more robust, and might be perhaps 10-20 
times bigger and more complex. For a simple example, with your intended 
list of Old/New usernames, the spec and script would need to address:
  - The old-name/new-name pairings are duplicated.
  - The old-name is duplicated - with different new-names
  - The new-name is duplicated (with different old-names)
  - The old-name has no matching folders/files.
  - There's data for an old-name, but that name is not in the list
  - Any old-name or new-name contains odd-ball leading/trailing/embedded 
characters - / \ , : spaces, accented-vowels, umlauts, etc, etc. (Eg, if 
you're running on an "English" system, and "foreign" chars are embedded 
in names of users/folders/files, that can be VERY interesting!!

So, it could end up as a 20-line "script", as one usually sees in 
scripting books, tutorials, etc. With no error-checking, permissions 
checks, disk-space checks, etc, etc, etc.....

Or a 500-line one!!

Best regards,
   - Mike



More information about the ILUG mailing list