I'm trying to write a very simple script in python to use Robocopy to copy some files from one dir to another. The files are around 35 Gb, so it takes some time to complete. this is what i'm trying:
def processing():
p=subprocess.Popen(['robocopy', f'{orig_dir}','/W:1','/R:5', f'{dest_dir}', '/E','/LOG:log.txt'])
while p.poll() is None:
pass
else:
print('not none')
The function works, I get the files copied and it informs back when the process is finished, but during the running time the all app freezes...
I tried with
p=subprocess.Popen(['robocopy', f'{orig_dir}','/W:1','/R:5', f'{dest_dir}', '/E','/LOG:log.txt'],shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
But it stills hangs. Is it because i'm using the pool to check if it is finished? Is there a better way(not too complicated)?
Edit : I already confirmed that checking poll is what makes the "freezing"
what is the best way to know when the Robocopy is finished?