in reply to moving files in a dir (Maildir) depending on Date

I dont know where to start, which functions to use in pearl i searched for "moving files" but didnt find exactly what i need in this case.

<pedantic>It's "Perl" for the language, "perl" for the executable name. Not "PERL", and certainly not "pearl".</pedantic>

As to not knowing where to start - I suggest figuring out the steps that you need to take to make this happen, and then creating those steps out of the available functions. Experienced programmers, of course, know what all (or most) of the functions are and design their programs out of those "building blocks"; since you appear to be just starting out, you'll need to run a few cycles of this before you succeed.

Here's an idea of how you might approach this (this is based on what you've already said; there are better approaches):

[pseudocode] Loop over the list of files in the source directory Read each file's date If date contains 2008 Move file to target directory End if End loop

That's half the job done for you. All you have to do is read "perldoc perlfunc" and fill in the blanks.


--
"Language shapes the way we think, and determines what we can think about."
-- B. L. Whorf

Replies are listed 'Best First'.
Re^2: moving files in a dir (Maildir) depending on Date
by matze77 (Friar) on Nov 30, 2008 at 10:32 UTC
    Hi Monks!
    You guessed it, i got another Mail related "problem":

    If i want to sort some mails depending on the message id,
    should i grep for the message id through all (Maildir) files or would it be better to use something like:
    Email::abstract
    get_header
    http://search.cpan.org/~rjbs/Email-Abstract-2.134/lib/Email/Abstract.pm#get_header

    The same would be for the header: "LIST-ID" field of some mailing lists,
    that are unfortunately lurking in my inbox cause i adjusted the filter later?

    I found a maybe related thread but i am not sure if i could use this, since it seems for mbox, but i dont understand it, completely to be honest:

    Reaping messages by Message-ID

    What about performance? is the cpan module ressource friendlier or the standard grep method.

    Or am i completely on the wrong path and you suggest something different.
    Some code which i could adjust to my needs would be appreciated.
    Thanks for your patience