| Gerald W. Lester 2006-10-23, 7:03 pm |
| Torsten Edler wrote:
>
> Hi Mark,
>
> synchronize (better backup) a directory structure to a different drive,
> basically traverse a directory tree: for each directory found recurse,
> for each file found check if file does not exist at destination drive
> (directory) or has a different mtime, if so copy it. As this is a time
> consuming task i wanted to use threads: the worker that does the
> directory processing and the master that has the GUI. The master sends
> name of source and destination directory to worker when "GO" button is
> pressed. Worker sends back a message to master whenever a directory is
> entered or finished, a file is copied or new directory created. The GUI
> maintains a text widget that logs basically the progress (messages from
> worker).
>
> Currently i have a non-threaded script that works. I guess if i don't
> split it into two threads the GUI freezes all over until all the work
> is done (update idletasks makes no difference). I experimented a little
> with "after" to start the directory processing but that did not help -
> as it shares CPU with GUI. So i started looking for threads to see if i
> might get it to work. First step was to use a worker for just copying
> the files but that did not help,
If that was the problem, you would not need threads. The fcopy with the
-command option would have solved your problem.
> i guess the directory work is the CPU
> hog tha makes GUI sluggish.
Are you burning 100% CPU cycles are waiting on network I/O for the directory
listing?
Remember -- always know your problem before attempting to solve it.
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
|