feat: create fileNum-check.py
Browse files- Processing/fileNum-check.py +31 -0
Processing/fileNum-check.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from glob import glob
|
| 2 |
+
from tqdm import tqdm
|
| 3 |
+
|
| 4 |
+
import shutil
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
path = "/home/limmireu/λ€μ΄λ‘λ/All"
|
| 9 |
+
fileNames = sorted(glob(path+"/*.png"))
|
| 10 |
+
|
| 11 |
+
fileNum = 0
|
| 12 |
+
|
| 13 |
+
for fileName in tqdm(fileNames[0: 7000]):
|
| 14 |
+
|
| 15 |
+
fileName = os.path.basename(fileName)
|
| 16 |
+
fileName = fileName.split(".")[0]
|
| 17 |
+
|
| 18 |
+
if fileNum == 7000:
|
| 19 |
+
break
|
| 20 |
+
|
| 21 |
+
if (os.path.isfile(f"/home/limmireu/λ€μ΄λ‘λ/All/{fileName}.png") and
|
| 22 |
+
os.path.isfile(f"/home/limmireu/λ€μ΄λ‘λ/All/{fileName}.xml")):
|
| 23 |
+
|
| 24 |
+
shutil.move(f"/home/limmireu/λ€μ΄λ‘λ/All/{fileName}.png",
|
| 25 |
+
f"/home/limmireu/λ€μ΄λ‘λ/file/{fileName}.png")
|
| 26 |
+
|
| 27 |
+
shutil.move(f"/home/limmireu/λ€μ΄λ‘λ/All/{fileName}.xml",
|
| 28 |
+
f"/home/limmireu/λ€μ΄λ‘λ/file/{fileName}.xml")
|
| 29 |
+
|
| 30 |
+
fileNum += 2
|
| 31 |
+
|