Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

change filename

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


ntserafica at gmail

Nov 23, 2009, 7:18 PM

Post #1 of 4 (1234 views)
Permalink
change filename

Is it possible to change filename of all incoming emails before it will be deliver to Maildir? Let's say I have a
filename 1258692713.M653901P24650.localhost. Can I change it to 1258692713.M653901P24650-200911.localhost. Can I apply
the output of the command "date +%F" in each incoming emails to append on the filename before it reach Maildir?


lists-qmail at maexotic

Nov 23, 2009, 11:01 PM

Post #2 of 4 (1163 views)
Permalink
Re: change filename [In reply to]

Hi,

the original spec is here:
http://cr.yp.to/proto/maildir.html
Maildir++ spec is here:
http://www.inter7.com/courierimap/README.maildirquota.html

Those define naming rules, which programs should adopt, to guarantee some
interoperability.

On Tue, Nov 24, 2009 at 11:18:26AM +0800, packets wrote:
> Is it possible to change filename of all incoming emails before it will be
> deliver to Maildir?

Is the question:
- is it possible like in "how can I do it"?
Then you might want to take a look at
http://www.jeenyus.net/linux/software/safecat.html
and modify the source code to produce the new names
Or modify qmail-local.c around line 700 in procedure maildir_child().
or is the question
- is it possible like in "will I break things"?
The you must check with your software accessing the maildirs.

But the main question to me is:
What problem are you trying to solve?

The information you try to add to the name is already stored in the
inode. You can access it with eg. "/bin/ls -l"
If you want a more easy to process list use (GNU) find like:
find /path -type f -printf "%CY%Cm %p\n"

\Maex


ntserafica at gmail

Nov 23, 2009, 11:50 PM

Post #3 of 4 (1168 views)
Permalink
Re: change filename [In reply to]

I implement safecat so that I can create another copy of emails outside Maildir directory. I want to create a script
wherein it will tar all files if the file was receive lets say November. All emails received last October will not be
included on tar. Since this is an old server and there are files wayback last year, its hard to use mtime options of
find command though still possible by calculating days. If I can append month and date on the filename, it could make my
life easier.

>
> But the main question to me is:
> What problem are you trying to solve?
>


lists-qmail at maexotic

Nov 24, 2009, 12:24 AM

Post #4 of 4 (1171 views)
Permalink
Re: change filename [In reply to]

On Tue, Nov 24, 2009 at 03:50:59PM +0800, packets wrote:
> I implement safecat so that I can create another copy of emails outside
> Maildir directory. I want to create a script wherein it will tar all files
> if the file was receive lets say November. All emails received last October
> will not be included on tar.

You may want to look at the GNU tar -N/--newer/--after-date options.
They allow to specify "DATE" as (from "info tar"):
* Calendar date items:: 19 Dec 1994.
* Time of day items:: 9:20pm.
* Time zone items:: EST, PDT, GMT.
* Day of week items:: Monday and others.
* Relative items in date strings:: next tuesday, 2 years ago.
* Pure numbers in date strings:: 19931219, 1440.
* Seconds since the Epoch:: @1078100502.

\Maex

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.