Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - Re: os.walk()

 
Thread Tools Search this Thread
Old 08-05-2009, 03:48 AM   #1
Default Re: os.walk()


On Tue, Aug 4, 2009 at 7:06 PM, Michael Savarese<> wrote:
> Greetings
> Python newbie here, and thanks to all who have helped me previously.
> Is there a way of grabbing file attributes while traversing with os.walk()?
> It would be advantageous to have date modified and file size along with the
> file name.
> If anyone can point me in the right direction, I'd appreciate it.


Feed the path to os.stat(), and then use the `stat` module on the result:
http://docs.python.org/library/os.html#os.stat
http://docs.python.org/library/stat.html#module-stat

Cheers,
Chris
--
http://blog.rebertia.com


Chris Rebert
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46