Re: Chronological Processing of Files

2005-09-26 Thread yoda
I've tried using the path module and it works like a *charm*.. plus my code is cleaner and clearer.. :) The list comprehension using os.stat() works well though I had to call an additional reverse() on the resultant list so that I could get the list in order of "newest first". So, in conclusion

Re: Chronological Processing of Files

2005-09-22 Thread yoda
Just to clarify: Newest== modified last The processing\sorting should apply to all the files found recursively during the entire walk. That being said, thanks for all the responses. I'll test the code shortly and get back to everyone. ps. This is why comp.lang.python is truly the greatest list

Re: Chronological Processing of Files

2005-09-21 Thread George Sakkis
"Peter Hansen" <[EMAIL PROTECTED]> wrote: > yoda wrote: > > This feels like a stupid question but I'll ask it anyway. > > > > How can I process files chronologically (newest last) when using > > os.walk()? > > Do you want the ordering to apply just to files within each directory, > or to all the f

Re: Chronological Processing of Files

2005-09-21 Thread Jeremy Jones
yoda wrote: >This feels like a stupid question but I'll ask it anyway. > > Definitely not a stupid question. >How can I process files chronologically (newest last) when using >os.walk()? > > > Try this: In [16]: file_list = [(os.stat(f)[8], f) for f in [os.path.join(i[0], j) for i in os.w

Re: Chronological Processing of Files

2005-09-21 Thread Paul
untested, ugly, but something like this would sort all the files in the directory on os.path.getctime (not using os.walk() though). I'm sure there is probably better ways to do it :) filelist = [] def walkdir(currdir): for files in os.listdir(currdir): path = os.path.join(currdir, fil

Re: Chronological Processing of Files

2005-09-21 Thread Peter Hansen
yoda wrote: > This feels like a stupid question but I'll ask it anyway. > > How can I process files chronologically (newest last) when using > os.walk()? Do you want the ordering to apply just to files within each directory, or to all the files found (recursively) during the entire walk? Define

Chronological Processing of Files

2005-09-21 Thread yoda
This feels like a stupid question but I'll ask it anyway. How can I process files chronologically (newest last) when using os.walk()? -- http://mail.python.org/mailman/listinfo/python-list