-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfileRename.py
More file actions
33 lines (26 loc) · 729 Bytes
/
Copy pathfileRename.py
File metadata and controls
33 lines (26 loc) · 729 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
import os
def correct100():
for f in os.listdir('.'):
if (not f.endswith('py') and len(f) == 2):
os.rename(f, '1'+f)
def correctnumbering(currrent, actual):
dif = actual - currrent
for f in os.listdir('.'):
if (not f.endswith('py')):
num = f[:len(f) - 4]
newname = str(int(num) + dif)
os.rename(f, newname)
def numtotxt():
for f in os.listdir('.'):
if (not f.endswith('py') and not f.endswith('txt')):
os.rename(f, f+'.txt')
def prepend(starting):
for f in os.listdir('.'):
if (not f.startswith(starting) and f.endswith('txt')):
name = f[:len(f) - 4]
zero = 4 - len(name)
newname = starting + '0'*zero + f
os.rename(f, newname)
correctnumbering(1, 216)
numtotxt()
prepend('e')