-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFix0B.py
29 lines (28 loc) · 800 Bytes
/
Fix0B.py
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 hashlib
import sqlite3 as sql
import sys
import datetime as dt
import time
# import ctypes
db = sql.connect('./FileData.db')
cur = db.cursor()
res = cur.execute('select * from sqlite_master where type=\'table\'')
res = res.fetchall()
for ids in res:
res = cur.execute(f'select * from "{ids[1]}" where FileSize=0;')
for idx in res:
print(idx)
try:
res = os.system(f'del /F /Q "{idx[0]}"')
if res:
with open('./error.log','a',encoding='utf8') as log:
log.write(f'{dt.datetime.now()}\t')
log.write(f'\tDelete File Failure:"{idx[0]}"\n')
else:
with open(idx[0],'w',encoding='utf8') as nf:
nf.write('')
except Exception as e:
with open('./error.log','a',encoding='utf8') as log:
log.write(f'{dt.datetime.now()}\t')
log.write(f'\t{e}\n')