listing files by modification time

Deepak Rokade smartpawn at gmail.com
Tue Feb 17 07:31:38 EST 2009


Hi,

I am using python 2.5 on sun solaris.

I want to limit the number of files returned by os.listdir() to some number
(say 1000), how can I do it ?

Also I wan to list the files only if they are older than some x days, how
can I do it?

I can do this through shell script using command.



find ${ DIR_PATH} -mtime +`expr ${PERIOD} - 1` -type f -exec ls  -l {} \;



I want to have similar functionality like above through python. I don't want
to list the whole files in directory and go to each file for checking it's
modification time.

I am thankful for any pointer.


-- 
Thanx & Regards,
Deepak Rokade

Do what u Enjoy &
               Enjoy what u Do...........
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090217/a3a398eb/attachment.html>


More information about the Python-list mailing list