diff options
author | kinitrupti | 2017-05-12 18:53:46 +0530 |
---|---|---|
committer | kinitrupti | 2017-05-12 18:53:46 +0530 |
commit | 6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch) | |
tree | 22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /pythonscript.py | |
parent | d36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff) | |
download | Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2 Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip |
Removed duplicates
Diffstat (limited to 'pythonscript.py')
-rw-r--r-- | pythonscript.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pythonscript.py b/pythonscript.py new file mode 100644 index 00000000..86e5e277 --- /dev/null +++ b/pythonscript.py @@ -0,0 +1,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)) |