Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking when shutil.copyfile is done

I have a such code:

for file in file_list:
    shutil.copyfile(file,newpath)
#do further actions

And here is the question, at #do further actions I use the copied f iles thus I need to make sure the shutil.copyfile functions finish their task. How can I make sure of this ?

like image 484
Hellnar Avatar asked Jun 29 '10 13:06

Hellnar


1 Answers

The shutil functions should return only after the operation is finished. If nothing funny is going on on the OS level it should be safe this way.

If you know the size of the file you could check if that is correct.

like image 173
Mad Scientist Avatar answered Oct 11 '22 08:10

Mad Scientist