Searching for and sorting files by date and compiling stats in Windows

A. Dimsdale and A. Moser fetus at AUTO
Thu Sep 26 23:16:28 CEST 2002

I (Aaron)'ve been called upon at work to compile statistics on MS Word temp-file
cruftup on the company's nationwide WAN, including the number of Word tempfiles
per year for the last three years before this one (by Date Modified), per
networked drive, and the amount of disk space used up by the aforementioned
cruft. (The purpose of this project being to give my boss something to use to
convince higher-up management to use a Python script that I am to write, which
would delete all Word cruft older than a specified date--which is how Alex and
I got into Python; I was the one who suggested we use it for the task, and got
the company to pay for a couple of Python reference books for me to teach myself
by.) How can I do the following in Python:
* Search through networked Windows drives for the string "~w*.tmp" (* meaning
wildcard of course) in the filename
* Calculate how much disk space is taken up by Word temp files by date modified
(i.e., files with "~w*.tmp" as their filenames with date modified in 2001 on
drive G: on SDspam01 use 75 MB total, files with "~w*.tmp" as their filenames with date modified in August 2002 on drive H: on DCspam04 use 60 MB total, etc.)
* Optimally, automagickally put this data into an MS Excel spreadsheet file
Sorry that's a lot of funk, but I've been combing MHammonds' win32all docs and
his "Programming Python on Windows 32" book, the other Python ref books the
company bought, and any online docs I can find and can't figure out how to do
all that jazz. Anybody who can help with this will have my eternal gratitude.
Aaron L. Dimsdale and Alex S. Moser
"But I don't like SPAM!"
"You don't like SPAM???"

More information about the Python-list mailing list