質問編集履歴
1
誤記があったため
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
しかし、コピペした画像が重複しております。
|
3
3
|
|
4
4
|
```
|
5
|
-
import time,shutil
|
5
|
+
import time,shutil,glob
|
6
6
|
from concurrent import futures
|
7
7
|
from pathlib import Path
|
8
8
|
|
@@ -11,22 +11,26 @@
|
|
11
11
|
r1=r"****"
|
12
12
|
r2=r"****"
|
13
13
|
|
14
|
+
r_1 = glob.glob(r1 + "\*.png")
|
15
|
+
r_2 = glob.glob(r2 + "\*.png")
|
16
|
+
|
14
17
|
t1 = time.time()
|
15
18
|
|
16
|
-
def func1(
|
19
|
+
def func1():
|
20
|
+
for path1 in r_1:
|
17
|
-
|
21
|
+
shutil.move(path1,r1 + "\" + os.path.basename(path1) + ".png" )
|
18
22
|
|
19
|
-
def func2(
|
23
|
+
def func2():
|
24
|
+
for path2 in r_2:
|
20
|
-
|
25
|
+
shutil.move(path2,r2 + "\" + os.path.basename(path2) + ".png" )
|
21
26
|
|
22
27
|
future_list = []
|
23
28
|
with futures.ThreadPoolExecutor() as executor:
|
24
|
-
for path in input_dir.glob("**/*.jpg"):
|
25
29
|
|
26
30
|
# タスクを追加する。
|
27
|
-
future1 = executor.submit(func1
|
31
|
+
future1 = executor.submit(func1)
|
28
32
|
future1.setDaemon(True)
|
29
|
-
future2 = executor.submit(func2
|
33
|
+
future2 = executor.submit(func2)
|
30
34
|
|
31
35
|
# Future オブジェクトを記録する。
|
32
36
|
future_list.append(future1)
|