Batch Rename emails in vmail

Discussion in 'Programming/Scripts' started by mmidgett, May 12, 2012.

  1. mmidgett

    mmidgett Member

    I have moved mail from my old server to the new one and the server name is stored into the file name. just copying the mail over it is displayed in IMAP but the new servers mails and other old servers mail are not sorted properly. I thought it might be the file name.

    I want to change

    -rw------- 1 vmail vmail 9455 May 6 06:31,S=9455:2,S


    -rw------- 1 vmail vmail 9455 May 6 06:31,S=9455:2,S

    and I have hundreds of files to change so it would be nice if I could just point a script to a directory and let it change them recursively.

    Will someone help me with this?
  2. A4P

    A4P New Member

    Batch Vmail Renaming


    It's really simple using "sed".

    There was a time long ago when I had a similar issue and it double dawned on me that some of the best tools in NIX are the oldest AND best which are "sed" & "awk".

    I could write a bash script for you but as I did many years ago before there were great tools to post like this one, just IRC that I found learning how to use "sed" and "awk" on my own has kept the knowledge intact for a few decades.

    Hope this helps? :)

    And forgive the bad pun following:

    "Just listen to what the man sed".
    Paul McCartney & Wings 1976


Share This Page