moving files in a seperate thread (and/or with progress?)

Jorgen Bodde jorgen.maillist at gmail.com
Wed Aug 15 05:28:18 EDT 2007


Hi all,

I want to make a small batch copy tool that scans for certain files,
and copies them to a specified directory. Since the files are huge
(AVI / DIVX) typical 300 to 700 Mb, I want to provide the user with
some feedback during the file copy.

Here is my dillemma; When I use shutil.move(..,..) I have to wait
until it's done, there is no feedback, so the GUI basically hangs.
However, shutil.move can be fast because it intelligently renames the
file when it is on the same medium, but slow when it moves to a
different one.
When I use my own implementation of a move mechanism that provides
feedback, I lose that intelligence, and I might slow down the copy
process unneccessarily.

When I move files, feedback is handy to have, but not neccesary so I
thought I can also call shutil.move from a seperate thread so the main
GUI stays responsive. What are my options in aborting a move by
killing the thread or are there other (3rdparty) modules I might use
to get better move or copy performances?

Just opening the file, performing a block copy myself seems like it
will slow down the transfer, but up until now I found no way to move
or copy with progress or abilities to abort the file transfer..

Any ideas?

Regards,
- Jorgen



More information about the Python-list mailing list