>>>>> J <dreadpiratej...@gmail.com> (J) wrote:

>J> And now I'm looking at subprocess and I can set shell=True and it will
>J> intrepret special characters like &

>J> So could I do something like this:

>J> for item in pathlist:
>J>     subprocess.Popen('rsync command &', shell=True)

>J> and simply wait unti they are all done?

Using shell=True is often the wrong thing to do. And certainly just to
get a process to run in the background. subprocess will run them in the
background by default. Besides if you do it in the way you propose you
can't wait for them. You can only wait for the shell that starts the
rsync, but that will be finished almost immediately.

>>> import subprocess
>>> p = subprocess.Popen('sleep 1000 &', shell=True)
>>> p.wait()
0
>>>
The wait() returns immediately.
-- 
Piet van Oostrum <p...@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
Nu Fair Trade woonaccessoires op http://www.zylja.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to