Help running Windows programs from Python

John Yeung gallium.arsenide at gmail.com
Fri May 7 21:37:57 EDT 2010


On May 7, 3:14 pm, Scott <scott.freem... at gmail.com> wrote:
> I want to write a script to automate log archiving/compressing on a
> Win2003 server. I have Python 2.6 installed. I am planning to use 7-
> zip for compression (because I have been using it manually for a while
> now). For now all operations will be local in the C: drive.

For your purposes, I personally think os.system() is enough of an
interface to 7-Zip and any other basic operating system commands you
might need for your task.  It's what I use myself to do batch
archiving with 7-Zip.

I think you will find everything you need within the os module (to get
the names of files and such), and of course Python's built-in string
methods.

Especially since you say you are a beginner, my recommendation is to
keep it simple; and to me, using only the os module is the simplest
way to go.  (That is why I went with it, after all. ;)

Also, don't be afraid to try stuff.  I can understand not wanting to
mess stuff up.  Well, create your own test directory and dummy files
to practice on first, and just have at it.

John



More information about the Python-list mailing list