blob: 86e5e2770c44833492db1649e51e0709e8131807 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import os,sys
rootdir = os.getcwd()
for path,dirname,files in os.walk(rootdir):
for file in files:
if file.endswith(".ipynb"):
filename = file.split('.')
version = filename[0].rsplit('_')
print version
if len(version)>1:
try:
int(version[-1])
file_new = file
except ValueError:
file_new = file.replace('_'+version[-1],'')
os.rename(os.path.join(path,file),os.path.join(path,file_new))
|