-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrenbad.py
More file actions
executable file
·40 lines (33 loc) · 771 Bytes
/
renbad.py
File metadata and controls
executable file
·40 lines (33 loc) · 771 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
30
31
32
33
34
35
36
37
38
39
40
#!/usr/local/bin/python3
# run within directory!!!
import os
good=["MO", 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']
def mkext(counter):
inc='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
day=int(counter/len(inc))
if day>=len(good):
print("no more exts")
exit(-1)
pos=counter%len(inc)
return good[day] + inc[pos]
c=0
for z in os.listdir('.'):
if z.endswith(".PKT"): continue
if z[8]!='.': continue
if len(z) not in [12,21,20,19,18]: continue
if len(z)==12 and z[9:11] in good: continue
new='FFFFFFFF.'+mkext(c)
print(z, new)
while 1:
try:
if not os.path.exists(new):
os.rename(z, new)
break
except Exception as e:
print(e)
finally:
c+=1
#c=0
#while 1:
# print mkext(c)
# c+=1