Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 8cc9cc9

Browse files
committed
for updating the project names as per standard
1 parent e2c1edf commit 8cc9cc9

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

standardize_project_name.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
import os
3+
4+
# Using os module to convert the file/folder's name
5+
projects_old = os.listdir("projects")
6+
projects_new = []
7+
for project in projects_old:
8+
name_old = project.lower()
9+
name = ""
10+
n = 0
11+
for c in name_old:
12+
if ord(c) in range(97, 123) or c == ".":
13+
name += c
14+
n = 1
15+
elif n == 1:
16+
name += " "
17+
n += 1
18+
else:
19+
pass
20+
21+
name_new = ""
22+
for word in name.split():
23+
if word in [
24+
"write",
25+
"create",
26+
"script",
27+
"a",
28+
]: # the list can be configured as per future requirement
29+
pass
30+
else:
31+
name_new = " ".join([f"{name_new}", f"{word}"]).strip()
32+
33+
if name_new.split()[0] in [
34+
"to",
35+
" ",
36+
]: # this list will provide extra truncation at statring word of name
37+
name_new = " ".join(name_new.split()[1:]).strip()
38+
39+
projects_new.append(name_new)
40+
41+
for i in range(len(projects_new)):
42+
os.rename(f"projects/{projects_old[i]}", f"projects/{projects_new[i]}")

0 commit comments

Comments
 (0)