problem with running os.path.walk()
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Oct 13 16:36:52 EDT 2009
En Tue, 13 Oct 2009 16:32:07 -0300, MalC0de <malc0de.encrypt at gmail.com>
escribió:
> where's the problem with the following code ? I couldn't see any
> result while running as a script :
>
>
> #!/usr/bin/python
> import time
> import os
> def walker2(arg,dirname,filenames):
> cutoff = time.time() - (arg * 24 * 60 * 60)
> for filename in filenames :
> stats = os.stat(dirname + os.sep + filename)
> modified = stats[8]
> if modified >= cutoff :
> print dirname + os.sep + filename
>
> os.path.walk('C:\\windows\\system',walker2,30)
>
> if I have problem with it then let me know and if is possible please
> fix it up .
Because all files in your c:\windows\system directory are older than one
month?
os.walk is simpler to use; stats.st_mtime is less "magical" than stats[8];
and I'd use os.path.join(dirname, filename) instead of +os.sep+
--
Gabriel Genellina
More information about the Python-list
mailing list