[Tutor] OT: Would this be difficult to do?

Kent Johnson kent37 at tds.net
Tue Jan 30 14:13:32 CET 2007

Lance Haig wrote:
> Hi,
> I have a need for a file system scanning tool that produces csv files of
> data that is older than a specified date.
> All the commercial ones I have found just don't quite do what I want.
> I have been a lurker on this list for some time and was wondering if
> this would be very difficult to do?

No, not difficult at all. Use os.walk() to walk the file system, 
os.path.getmtime() to get the time of last modification, the csv module 
to write the csv file. Use datetime.datetime for time arithmetic and to 
format the times if you want that in the csv file. It's probably a 20-30 
line program if you just want a list of file names and dates.

You might also like to use the path module instead of os.walk() etc:


More information about the Tutor mailing list