| 126 | self.progress_bar.update(1) |
| 127 | |
| 128 | def dispatch_workers(self, |
| 129 | file_list: List[str]): |
| 130 | n_threads = self.thread_num |
| 131 | for i in range(n_threads): |
| 132 | t = threading.Thread(target=self.single_copy) |
| 133 | t.daemon = True |
| 134 | t.start() |
| 135 | print('{} copy daemons started'.format(n_threads)) |
| 136 | self.progress_bar = tqdm(total=self.total_files) |
| 137 | for file_name in file_list: |
| 138 | self.file_queue.put(file_name) |
| 139 | self.file_queue.join() |
| 140 | self.progress_bar.close() |
| 141 | print('{}/{} files copied successfully.'.format(len(file_list), |
| 142 | self.total_files)) |
| 143 | if self.delete: |
| 144 | shutil.rmtree(self.src_dir) |
| 145 | |
| 146 | |
| 147 | if __name__ == '__main__': |