Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do asynchronous file copying in Python?

I'm working on a function in Python that takes in a list of file paths and a list of destinations, and copies each file to each of the given destinations. I have the copying portion of this function working correctly, but I need to be able to run this function asynchronously apart from the operation of a gui so that less time is taken filling out each "form." I also need the copying function to inform the user each time a file has been copied to all of the directories.

I have done a little bit of research on how to do this, but each option is quite different, using different libraries for example. How would you suggest I do this?

like image 763
Jonathan Wrona Avatar asked May 25 '26 08:05

Jonathan Wrona


1 Answers

Since your problem is a IO bound, I would recommend you to look at threading module. With combination of Queue module you will achieve that.

like image 87
Vor Avatar answered May 28 '26 16:05

Vor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!