Multiple os.system calls 
Author Message
 Multiple os.system calls

Hello Everyone,

I am trying to send a list of filenames to tar.  Right
now I'm doing this with multiple calls to os.system,
changing the filename each time.  Horrible I know, but
I haven't figured out how to use the other os fuctions
to accomplish this any better.  Can someone enlighten
me?

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://www.*-*-*.com/



Tue, 22 Jun 2004 07:09:14 GMT  
 Multiple os.system calls
Hello Rob

Quote:

> I am trying to send a list of filenames to tar.  Right
> now I'm doing this with multiple calls to os.system,
> changing the filename each time.  Horrible I know, but
> I haven't figured out how to use the other os fuctions
> to accomplish this any better.  Can someone enlighten
> me?

You could use os.popen to feed the filenames to tar via standard input.

Stefan



Tue, 22 Jun 2004 08:20:58 GMT  
 Multiple os.system calls

Quote:
> Hello Everyone,

> I am trying to send a list of filenames to tar.  Right
> now I'm doing this with multiple calls to os.system,
> changing the filename each time.  Horrible I know, but
> I haven't figured out how to use the other os fuctions
> to accomplish this any better.  Can someone enlighten
> me?

What about os.system('tar cf result.tar ' + ' '.join(thefilenames))?
Assuming that what tar is doing with the filenames is adding
them to a tarfile, of course (you don't really make that very
clear, at least not to my reading).

Alex



Tue, 22 Jun 2004 21:05:24 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. OS independent scripts, system calls on Windows and Linux

2. strange problem with os.system() call

3. grabbing return codes from os.system() call

4. problem with os.system calls under win32

5. Getting stdout and/or stderr output from an os.system() call

6. problems with shell environment in os.system calls

7. Getting return value in os.system rsh call

8. os.popen() vs os.system()

9. Using os.system and os.popen from pythonwin under Windows NT

10. os.system() or os.execv() w/stdout redirect and PID tracking

11. os.system/os.popen ultrasparc

12. Blocking ctrl-c to os.popen() or os.system()

 

 
Powered by phpBB® Forum Software