[Tutor] working with os module

Dwain Hargrave dwainh@corp.earthlink.net
Wed, 25 Oct 2000 16:20:11 -0500


If I have a range of directories named "log1" through "log15" in a UNIX
environment.

I want to cd to the the log1 directory to work with some files and add
another sub-directory, then cd to log2...

How can this be accomplished.  This is the train of thought I was
going.  I'm very new to python.  Resisting the urge by my peers to use
Perl.

#! /usr/bin/python

import sys, os

x = 0

for x in range(1,16):
  if x < 16:
    os.chdir("/fake/structure/log")
    os.mkdir("archive")
    print "Added /fake/structure/log", x   <-- side question how would I
have it move to the left one space
  else:
    print "------------"
    print "I'm all done"


--
Dwain Hargrave
Unix Systems Administrator
Earthlink Inc.