os.execl()

Brian E Gallew geek+ at andrew.cmu.edu
Mon Aug 27 10:14:02 EDT 2001


Then <geek+ at andrew.cmu.edu> spoke up and said:
> NNTP-Posting-Host: po7.andrew.cmu.edu
> That really won't do what you want it to do.  You probably want to do
> something like this:
> 
> #! /usr/bin/env python
> import os,glob
> 
> cmd = [ '/usr/bin/tar',
> 	'-x',
> 	'-z',
> 	'-f',
>       ]
> 
> tar_file_list = glob.glob('*.tar.gz')
> 
> for tar_file in tar_file_list:
>     if os.fork():
>        os.wait()
>     else:
>        os.exec(cmd[0], cmd + [tar_file,])

The observant reader will note that os.exec should really be os.execv.




More information about the Python-list mailing list