-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckPic.py
More file actions
29 lines (21 loc) · 780 Bytes
/
checkPic.py
File metadata and controls
29 lines (21 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import stat
import shutil
MOBILE_PIC_PATH = "D:\\BaiduNetdiskDownload\\saveMobilePaper"
TARGET_SIZE = 1772273
# 移动位置
MOBILE_MOVE_PATH = "D:\\BaiduNetdiskDownload\\MOVE_PATH"
os.makedirs(MOBILE_MOVE_PATH, exist_ok=True)
for root, dirs, files in os.walk(MOBILE_PIC_PATH):
for file in files:
file_path = os.path.join(root, file)
file_ext = os.path.splitext(file_path)[-1].lower()
file_size = os.path.getsize(file_path)
if file_size == TARGET_SIZE:
print(file_path)
# shutil.move(file_path, MOBILE_MOVE_PATH)
try:
os.remove(file_path)
except PermissionError:
os.chmod(file_path, stat.S_IWRITE)
os.remove(file_path)