-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming the STL files for the UC2 configurator
- Loading branch information
1 parent
0abd1c7
commit 4c63ce7
Showing
88 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Sat Jan 9 14:55:03 2021 | ||
@author: diederichbenedict | ||
""" | ||
# rename the following pattern: | ||
# *v3_XXX.stl -> *v3.stl | ||
# or | ||
# *_XXX.stl -> v3 (more generic!) | ||
|
||
|
||
import os | ||
|
||
delimiter = '_' | ||
filetype = '.stl' | ||
basefolder = 'C:\\Users\\diederichbenedict\\Dropbox\\Dokumente\\Promotion\\PROJECTS\\UC2-GIT\\CAD\\RAW\\STL\\' | ||
basefolder = '/Users/bene/Dropbox/Dokumente/Promotion/PROJECTS/UC2-GIT/CAD/RAW/STL/' | ||
|
||
import glob, os | ||
os.chdir(basefolder) | ||
for filename in glob.glob("*"+filetype): | ||
filename_final = '' | ||
|
||
filename_split = filename.split(delimiter) | ||
for i in range(len(filename_split)-1): | ||
if not filename_split[i] == 'v3': | ||
filename_final += (filename_split[i] + delimiter) | ||
|
||
filename_final += 'v3'+filetype | ||
|
||
print(filename + " -> " + filename_final) | ||
|
||
# rename | ||
os.rename(filename,filename_final) |