Hi,

I have a python program needs to do some download task from file server to
local disk regularly.
I intend to call robocopy.exe (a download tool in windows) do the real
download job.

--Below codes works:
DownloadArgs = " \\servername\Sourcepath
<file://servername/Sourcepath>d:\destinationPath *.bin"
os.system("robocopy.exe" +" "+ "DownloadArgs")

But the problem is :
1.Program halt until this robocopy download complete.
  As the download will last 2~3hours, I want to do and display something
while downloading.
  Such as display a ">" each 10 seconds while downloading.

2.robocopy's output display in console.
  I want to hide robocopy's output, meanwhile get latest output each 10
secends then display only a portion of it.

--Then I use:
p = subprocess.Popen(["robocopy.exe" +" " + "DownloadArgs"],Shell =
True,stdout = PIPE)
p.communicate()

This can hide robocopy's output, but still can't display the download
process is going.

--Then I use:
print "Download begin ..."
 p = subprocess.Popen(["robocopy.exe" +" " + "DownloadArgs"],Shell =
True,stdout = PIPE)
while not str(p.poll()).isdigit():
    print ">",
    time.sleep(10)
    #don't know how to grab output and display portion of it
print "Download complete with retval (%d) "% (p.poll())

This will make robocopy never terminate, and display ">>>>>>" forever.

Any suggestion is welcome. Thanks in advance.

Regards,
Colin
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to