how to filter files by creation date

awel albert.wellens at gmail.com
Tue Nov 6 04:45:02 EST 2007


On 6 nov, 09:00, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote:
> > I am trying to to make a script to move all the files that has been
> > created at today's to another folder but my problem is the date format
> > that I receive from the 'os.stat  [stat.ST_CTIME]' is different from
> > the one that I receive from the 'datetime.date.today()'.
>
> Build a `datetime.date` object from the timestamp you get from the stat
> call:
>
> In [438]: !touch test.py
>
> In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime)
> Out[439]: datetime.date(2007, 11, 6)
>
> Ciao,
>         Marc 'BlackJack' Rintsch

Could you explain a little more because I am new in scripting?
Thanks
Awel




More information about the Python-list mailing list