[Tutor] Automating Windows (Maintenance)
alan.gauld at btinternet.com
Tue Jul 3 01:00:29 CEST 2007
"Daniel McQuay" <simplebob at gmail.com> wrote
> I wondering if any one uses Python to do such things as defragment,
> clean up
> temp files, check for hard drive errors, check for unusual processes
> running, and so on.
Mostly I rely on Windows schedulling to do those things because
the tools exist I just use them.
But the last is something that could be done in Python, either
using windows services or even the os module.
And of course you can execute Windows rograms from Python
using os.system or the new subprocess module
> am pretty new to Python but I seem to understand it a little better
> than VB
Anything you can do in VBScript you can do in Python, especially
using WSH which makes a lot of these kinds of tasks easier.
> a batch script that cleans up temp files and defragments the hard
> drive but
> I would like to know if Python is a good candidate for this or
> should I
> just stick to what is built into Windows.
I tend to use the OS for OS tasks wherever possible. Defragging
for example is a simple enough thing to set up using Windows
scheduller But where I have to program then I use the tool that feels
right for the job, which for me could be any of Python, Delphi, DOS
Author of the Learn to Program web site
More information about the Tutor