473,472 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
Aug 15 '07 #1
2 3824
On Aug 15, 4:28 am, "Jorgen Bodde" <jorgen.maill...@gmail.comwrote:
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
What GUI toolkit are you using? I know that wxPython has a status
widget that could be updated in a thread and it has some good examples
of using threads with long running tasks. I created a program with it
that deletes folders and updates me on its progress.

You can see the wxPython implementation here: http://wiki.wxpython.org/LongRunningTasks

Their widget is called a ProgressDialog. I think there's a custom one
too...

Mike

Aug 15 '07 #2
On Aug 15, 2:28 am, "Jorgen Bodde" <jorgen.maill...@gmail.comwrote:
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
The following link helped me to pull it off with Tkinter. A
complicated example, but very well written.

http://uucode.com/texts/pylongopgui/pyguiapp.html

~Sean

Aug 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Jason Jacob | last post by:
To all, I have a GUI program (use c#), and I have create a Thread for loading some bulk data, I also arrange the GUI program like this: 1) load a form showing "Wait for loading..." etc 2) a...
6
by: Botak | last post by:
I am able to simulate and run the "thread" as adviced earlier from my previous post. Thanks for the tips. Now I am stucked at how to get the progress status from the thread. I have a main form...
3
by: Paul Spielvogel | last post by:
I need to compute the MD5 hash on VERY large files 500mb to 4gb+ I have found two ways but neither one of them does what i need. Private Function ComputeDataMD5(ByVal path As String) As String...
7
by: Joe | last post by:
I need a control to always run in a separate thread from the application. I'm not too sure where to begin with this since the control could be dropped on the form at design time. One possible...
4
by: Joachim | last post by:
Is there an efficient way of copying a file and at the same time updating a progress bar with short intervals to see how much is still to copy of the file? Like some FTP programs have for instance.
2
by: Don | last post by:
How to stop a process which is running in a separate thread!!! I've got a class which performs some lengthy process in a background (separate) thread. And this lengthy process raises events...
3
by: Martin Pöpping | last post by:
Hello, I want to change a ProgressBar in a separate Thread. My current code is the following: private void changeProgressBarThread() { changeProgressBar(); }
0
by: Nishanthmarathe | last post by:
Hi There!!! I am new to C# world. I am getting huge chunk of data from a 3rd party applications thru SOAP request and updating to my SQL Server. I cant implement Progress bar as there is no way...
6
by: JB | last post by:
Hi All, I have a Windows Form application that shows a "please wait" form while I query a database for various information. I display my form using Show, then run my DB query, then Close the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.